@cetusprotocol/dlmm-sdk 1.3.2 → 1.3.3
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/dist/index.d.ts +21 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -576,6 +576,12 @@ declare class PositionModule implements IModule<CetusDlmmSDK> {
|
|
|
576
576
|
coin_a_obj: TransactionObjectArgument;
|
|
577
577
|
coin_b_obj: TransactionObjectArgument;
|
|
578
578
|
};
|
|
579
|
+
/**
|
|
580
|
+
* Position principal in token raw units.
|
|
581
|
+
* Loads each occupied bin and applies floor(bin.amount * share / bin.liquidity).
|
|
582
|
+
* Returned amounts exclude LP fees.
|
|
583
|
+
*/
|
|
584
|
+
getPositionAmounts(position: Pick<DlmmPosition, 'lower_bin_id' | 'liquidity_shares'>, pool: Pick<DlmmPool, 'active_id' | 'bin_step' | 'bin_manager'>, requestOptions?: RpcRequestOptions): Promise<BinLiquidityInfo>;
|
|
579
585
|
/**
|
|
580
586
|
* Get the amounts in the active bin if in range
|
|
581
587
|
* @param bin_manager_handle - The bin manager handle
|
|
@@ -796,6 +802,12 @@ declare function parseDlmmBasePool(data: SuiEvent): DlmmBasePool;
|
|
|
796
802
|
declare function parseDlmmPool(data: any): DlmmPool;
|
|
797
803
|
declare function parsePartner(data: any): Partner;
|
|
798
804
|
declare function parseDlmmPosition(data: any): DlmmPosition;
|
|
805
|
+
/**
|
|
806
|
+
* Position principal from on-chain bin reserves.
|
|
807
|
+
* Each bin is floor(bin.amount * positionShare / bin.liquidity), then summed.
|
|
808
|
+
* `stored_bins` must include every bin whose position share is non-zero.
|
|
809
|
+
* Fees are not included.
|
|
810
|
+
*/
|
|
799
811
|
declare function parseLiquidityShares(liquidity_shares: string[], bin_step: number, lower_bin_id: number, active_bin: BinAmount, stored_bins?: BinAmount[]): BinLiquidityInfo;
|
|
800
812
|
declare function parseBinInfoList(res: any): BinAmount[];
|
|
801
813
|
declare function parseBinInfo(fields: any): BinAmount;
|
|
@@ -980,6 +992,15 @@ declare class BinUtils {
|
|
|
980
992
|
* @param remove_liquidity - The amount of liquidity to be removed
|
|
981
993
|
* @returns The amount of token A and token B to be removed
|
|
982
994
|
*/
|
|
995
|
+
static mulDivFloor(amount: string, share: string, totalShare: string): string;
|
|
996
|
+
/**
|
|
997
|
+
* Position principal in one bin, matching the contract:
|
|
998
|
+
* floor(bin.amount * positionShare / bin.totalLiquidityShare).
|
|
999
|
+
*/
|
|
1000
|
+
static calculatePositionBinAmounts(bin: BinAmount, positionLiquidityShare: string): {
|
|
1001
|
+
amount_a: string;
|
|
1002
|
+
amount_b: string;
|
|
1003
|
+
};
|
|
983
1004
|
static calculateOutByShare(bin: BinAmount, remove_liquidity: string): {
|
|
984
1005
|
amount_a: string;
|
|
985
1006
|
amount_b: string;
|