@cetusprotocol/dlmm-sdk 1.2.3 → 1.2.5
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 +3 -3
- package/dist/index.d.ts +10 -154
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -58,11 +58,11 @@ const sdk = CetusDlmmSDK.createSDK({
|
|
|
58
58
|
})
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
**Option 4: Use custom
|
|
61
|
+
**Option 4: Use custom SuiClient**
|
|
62
62
|
```typescript
|
|
63
|
-
import {
|
|
63
|
+
import { SuiClient } from '@mysten/sui/client'
|
|
64
64
|
|
|
65
|
-
const suiClient = new
|
|
65
|
+
const suiClient = new SuiClient({ url: 'YOUR_RPC_URL' })
|
|
66
66
|
const sdk = CetusDlmmSDK.createSDK({ env: 'mainnet', sui_client: suiClient })
|
|
67
67
|
```
|
|
68
68
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { CoinPairType, TableHandle, IModule, PaginationArgs, DataPage, PageQuery, SdkWrapper, BaseSdkOptions, Package } from '@cetusprotocol/common-sdk';
|
|
2
2
|
import { TransactionObjectArgument, Transaction } from '@mysten/sui/transactions';
|
|
3
3
|
import Decimal from 'decimal.js';
|
|
4
|
-
import
|
|
5
|
-
import { SuiEvent, DevInspectResults } from '@mysten/sui/jsonRpc';
|
|
4
|
+
import { DevInspectResults, SuiEvent, SuiObjectResponse, SuiTransactionBlockResponse } from '@mysten/sui/jsonRpc';
|
|
6
5
|
import BN from 'bn.js';
|
|
7
6
|
|
|
8
7
|
type DlmmConfigs = {
|
|
@@ -448,7 +447,7 @@ declare class PoolModule implements IModule<CetusDlmmSDK> {
|
|
|
448
447
|
getBinInfoList(options: GetBinInfoOption[]): Promise<GetBinInfoResult[]>;
|
|
449
448
|
getTotalFeeRate(option: GetTotalFeeRateOption): Promise<FeeRate>;
|
|
450
449
|
getPoolBinInfo(option: GetPoolBinInfoOption): Promise<BinAmount[]>;
|
|
451
|
-
getPoolTransactionList({ pool_id, pagination_args, full_rpc_url, }: {
|
|
450
|
+
getPoolTransactionList({ pool_id, pagination_args, order, full_rpc_url, }: {
|
|
452
451
|
pool_id: string;
|
|
453
452
|
full_rpc_url?: string;
|
|
454
453
|
pagination_args: PageQuery;
|
|
@@ -779,18 +778,18 @@ declare function parseDlmmBasePool(data: SuiEvent): DlmmBasePool;
|
|
|
779
778
|
* @param data - The DLMM pool data
|
|
780
779
|
* @returns The DLMM pool
|
|
781
780
|
*/
|
|
782
|
-
declare function parseDlmmPool(data:
|
|
783
|
-
declare function parsePartner(data:
|
|
784
|
-
declare function parseDlmmPosition(data:
|
|
781
|
+
declare function parseDlmmPool(data: SuiObjectResponse): DlmmPool;
|
|
782
|
+
declare function parsePartner(data: SuiObjectResponse): Partner;
|
|
783
|
+
declare function parseDlmmPosition(data: SuiObjectResponse): DlmmPosition;
|
|
785
784
|
declare function parseLiquidityShares(liquidity_shares: string[], bin_step: number, lower_bin_id: number, active_bin: BinAmount): BinLiquidityInfo;
|
|
786
|
-
declare function parseBinInfoList(res:
|
|
785
|
+
declare function parseBinInfoList(res: DevInspectResults): BinAmount[];
|
|
787
786
|
declare function parseBinInfo(fields: any): BinAmount;
|
|
788
|
-
declare function parsedDlmmPosFeeData(
|
|
789
|
-
declare function parsedDlmmPosRewardData(
|
|
787
|
+
declare function parsedDlmmPosFeeData(simulate_res: DevInspectResults): Record<string, PositionFee>;
|
|
788
|
+
declare function parsedDlmmPosRewardData(simulate_res: DevInspectResults): Record<string, PositionReward>;
|
|
790
789
|
declare function parsedSwapQuoteData(simulate_res: DevInspectResults, a2b: boolean): PreSwapQuote | undefined;
|
|
791
790
|
declare function parseStrategyType(strategy_type: StrategyType): number;
|
|
792
791
|
declare const poolFilterEvenTypes: string[];
|
|
793
|
-
declare function parsePoolTransactionInfo(
|
|
792
|
+
declare function parsePoolTransactionInfo(data: SuiTransactionBlockResponse, txIndex: number, package_id: string, pool_id: string): PoolTransactionInfo[];
|
|
794
793
|
declare function generateRewardSchedule(baseTime: number, maxIntervals: number, timeInterval: number): number[];
|
|
795
794
|
declare function parseRewardPeriodEmission(periodEmissionList: RewardPeriodEmission[], startTimeInSeconds: number, endTimeInSeconds: number, durationSeconds: number): RewardPeriodEmissionFormat[];
|
|
796
795
|
declare function parseCurrentRewardPeriodEmission(periodEmissionList: RewardPeriodEmission[]): RewardPeriodEmission | undefined;
|
|
@@ -798,149 +797,6 @@ declare function safeMulAmount(amount: Decimal, rate: Decimal, verify?: boolean)
|
|
|
798
797
|
declare function safeAmount(amount: Decimal, verify?: boolean): Decimal;
|
|
799
798
|
declare function getRouterModule(strategy_type: StrategyType): "spot" | "curve" | "bid_ask";
|
|
800
799
|
declare function buildPoolKey(coin_type_a: string, coin_type_b: string, bin_step: number, base_factor: number): string;
|
|
801
|
-
declare const PoolSimpleInfoRaw: _mysten_sui_bcs.BcsStruct<{
|
|
802
|
-
pool_id: _mysten_sui_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
803
|
-
pool_key: _mysten_sui_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
804
|
-
coin_type_a: _mysten_sui_bcs.BcsStruct<{
|
|
805
|
-
name: _mysten_sui_bcs.BcsType<string, string, "string">;
|
|
806
|
-
}, string>;
|
|
807
|
-
coin_type_b: _mysten_sui_bcs.BcsStruct<{
|
|
808
|
-
name: _mysten_sui_bcs.BcsType<string, string, "string">;
|
|
809
|
-
}, string>;
|
|
810
|
-
bin_step: _mysten_sui_bcs.BcsType<number, number, "u16">;
|
|
811
|
-
base_factor: _mysten_sui_bcs.BcsType<number, number, "u16">;
|
|
812
|
-
}, string>;
|
|
813
|
-
declare const NodeIDPoolSimpleInfo: _mysten_sui_bcs.BcsStruct<{
|
|
814
|
-
prev: _mysten_sui_bcs.BcsType<Uint8Array<ArrayBufferLike> | null, Iterable<number> | null | undefined, "Option<bytes[32]>">;
|
|
815
|
-
next: _mysten_sui_bcs.BcsType<Uint8Array<ArrayBufferLike> | null, Iterable<number> | null | undefined, "Option<bytes[32]>">;
|
|
816
|
-
value: _mysten_sui_bcs.BcsStruct<{
|
|
817
|
-
pool_id: _mysten_sui_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
818
|
-
pool_key: _mysten_sui_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
819
|
-
coin_type_a: _mysten_sui_bcs.BcsStruct<{
|
|
820
|
-
name: _mysten_sui_bcs.BcsType<string, string, "string">;
|
|
821
|
-
}, string>;
|
|
822
|
-
coin_type_b: _mysten_sui_bcs.BcsStruct<{
|
|
823
|
-
name: _mysten_sui_bcs.BcsType<string, string, "string">;
|
|
824
|
-
}, string>;
|
|
825
|
-
bin_step: _mysten_sui_bcs.BcsType<number, number, "u16">;
|
|
826
|
-
base_factor: _mysten_sui_bcs.BcsType<number, number, "u16">;
|
|
827
|
-
}, string>;
|
|
828
|
-
}, string>;
|
|
829
|
-
declare const Bin: _mysten_sui_bcs.BcsStruct<{
|
|
830
|
-
id: _mysten_sui_bcs.BcsType<number, number, "u32">;
|
|
831
|
-
amount_a: _mysten_sui_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
832
|
-
amount_b: _mysten_sui_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
833
|
-
price: _mysten_sui_bcs.BcsType<string, string | number | bigint, "u128">;
|
|
834
|
-
liquidity_share: _mysten_sui_bcs.BcsType<string, string | number | bigint, "u128">;
|
|
835
|
-
rewards_growth_global: _mysten_sui_bcs.BcsType<string[], Iterable<string | number | bigint> & {
|
|
836
|
-
length: number;
|
|
837
|
-
}, string>;
|
|
838
|
-
fee_a_growth_global: _mysten_sui_bcs.BcsType<string, string | number | bigint, "u128">;
|
|
839
|
-
fee_b_growth_global: _mysten_sui_bcs.BcsType<string, string | number | bigint, "u128">;
|
|
840
|
-
}, string>;
|
|
841
|
-
declare const BinGroup: _mysten_sui_bcs.BcsStruct<{
|
|
842
|
-
idx: _mysten_sui_bcs.BcsType<number, number, "u32">;
|
|
843
|
-
used_bins_mask: _mysten_sui_bcs.BcsType<number, number, "u16">;
|
|
844
|
-
bins: _mysten_sui_bcs.BcsType<{
|
|
845
|
-
id: number;
|
|
846
|
-
amount_a: string;
|
|
847
|
-
amount_b: string;
|
|
848
|
-
price: string;
|
|
849
|
-
liquidity_share: string;
|
|
850
|
-
rewards_growth_global: string[];
|
|
851
|
-
fee_a_growth_global: string;
|
|
852
|
-
fee_b_growth_global: string;
|
|
853
|
-
}[], Iterable<{
|
|
854
|
-
id: number;
|
|
855
|
-
amount_a: string | number | bigint;
|
|
856
|
-
amount_b: string | number | bigint;
|
|
857
|
-
price: string | number | bigint;
|
|
858
|
-
liquidity_share: string | number | bigint;
|
|
859
|
-
rewards_growth_global: Iterable<string | number | bigint> & {
|
|
860
|
-
length: number;
|
|
861
|
-
};
|
|
862
|
-
fee_a_growth_global: string | number | bigint;
|
|
863
|
-
fee_b_growth_global: string | number | bigint;
|
|
864
|
-
}> & {
|
|
865
|
-
length: number;
|
|
866
|
-
}, string>;
|
|
867
|
-
}, string>;
|
|
868
|
-
declare const BinGroupRefRaw: _mysten_sui_bcs.BcsStruct<{
|
|
869
|
-
pool_id: _mysten_sui_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
870
|
-
group: _mysten_sui_bcs.BcsStruct<{
|
|
871
|
-
idx: _mysten_sui_bcs.BcsType<number, number, "u32">;
|
|
872
|
-
used_bins_mask: _mysten_sui_bcs.BcsType<number, number, "u16">;
|
|
873
|
-
bins: _mysten_sui_bcs.BcsType<{
|
|
874
|
-
id: number;
|
|
875
|
-
amount_a: string;
|
|
876
|
-
amount_b: string;
|
|
877
|
-
price: string;
|
|
878
|
-
liquidity_share: string;
|
|
879
|
-
rewards_growth_global: string[];
|
|
880
|
-
fee_a_growth_global: string;
|
|
881
|
-
fee_b_growth_global: string;
|
|
882
|
-
}[], Iterable<{
|
|
883
|
-
id: number;
|
|
884
|
-
amount_a: string | number | bigint;
|
|
885
|
-
amount_b: string | number | bigint;
|
|
886
|
-
price: string | number | bigint;
|
|
887
|
-
liquidity_share: string | number | bigint;
|
|
888
|
-
rewards_growth_global: Iterable<string | number | bigint> & {
|
|
889
|
-
length: number;
|
|
890
|
-
};
|
|
891
|
-
fee_a_growth_global: string | number | bigint;
|
|
892
|
-
fee_b_growth_global: string | number | bigint;
|
|
893
|
-
}> & {
|
|
894
|
-
length: number;
|
|
895
|
-
}, string>;
|
|
896
|
-
}, string>;
|
|
897
|
-
}, string>;
|
|
898
|
-
declare const SkipListNodeBinGroupRefRaw: _mysten_sui_bcs.BcsStruct<{
|
|
899
|
-
score: _mysten_sui_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
900
|
-
prev: _mysten_sui_bcs.BcsType<{
|
|
901
|
-
is_none: boolean;
|
|
902
|
-
v: string;
|
|
903
|
-
}[], Iterable<{
|
|
904
|
-
is_none: boolean;
|
|
905
|
-
v: string | number | bigint;
|
|
906
|
-
}> & {
|
|
907
|
-
length: number;
|
|
908
|
-
}, string>;
|
|
909
|
-
next: _mysten_sui_bcs.BcsStruct<{
|
|
910
|
-
is_none: _mysten_sui_bcs.BcsType<boolean, boolean, "bool">;
|
|
911
|
-
v: _mysten_sui_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
912
|
-
}, string>;
|
|
913
|
-
value: _mysten_sui_bcs.BcsStruct<{
|
|
914
|
-
pool_id: _mysten_sui_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
915
|
-
group: _mysten_sui_bcs.BcsStruct<{
|
|
916
|
-
idx: _mysten_sui_bcs.BcsType<number, number, "u32">;
|
|
917
|
-
used_bins_mask: _mysten_sui_bcs.BcsType<number, number, "u16">;
|
|
918
|
-
bins: _mysten_sui_bcs.BcsType<{
|
|
919
|
-
id: number;
|
|
920
|
-
amount_a: string;
|
|
921
|
-
amount_b: string;
|
|
922
|
-
price: string;
|
|
923
|
-
liquidity_share: string;
|
|
924
|
-
rewards_growth_global: string[];
|
|
925
|
-
fee_a_growth_global: string;
|
|
926
|
-
fee_b_growth_global: string;
|
|
927
|
-
}[], Iterable<{
|
|
928
|
-
id: number;
|
|
929
|
-
amount_a: string | number | bigint;
|
|
930
|
-
amount_b: string | number | bigint;
|
|
931
|
-
price: string | number | bigint;
|
|
932
|
-
liquidity_share: string | number | bigint;
|
|
933
|
-
rewards_growth_global: Iterable<string | number | bigint> & {
|
|
934
|
-
length: number;
|
|
935
|
-
};
|
|
936
|
-
fee_a_growth_global: string | number | bigint;
|
|
937
|
-
fee_b_growth_global: string | number | bigint;
|
|
938
|
-
}> & {
|
|
939
|
-
length: number;
|
|
940
|
-
}, string>;
|
|
941
|
-
}, string>;
|
|
942
|
-
}, string>;
|
|
943
|
-
}, string>;
|
|
944
800
|
|
|
945
801
|
declare const SCALE_OFFSET = 64;
|
|
946
802
|
declare const ONE: BN;
|
|
@@ -1271,4 +1127,4 @@ declare const dlmmMainnet: SdkOptions;
|
|
|
1271
1127
|
|
|
1272
1128
|
declare const dlmmTestnet: SdkOptions;
|
|
1273
1129
|
|
|
1274
|
-
export { type AddLiquidityOption, type AddRewardOption, type Axis, BASIS_POINT, BASIS_POINT_MAX, BIN_BOUND, type BaseAddLiquidityOption, type BaseCalculateAddLiquidityOption, type BaseCreatePoolAndAddOption, type BaseCreatePoolOption,
|
|
1130
|
+
export { type AddLiquidityOption, type AddRewardOption, type Axis, BASIS_POINT, BASIS_POINT_MAX, BIN_BOUND, type BaseAddLiquidityOption, type BaseCalculateAddLiquidityOption, type BaseCreatePoolAndAddOption, type BaseCreatePoolOption, type BinAmount, type BinLiquidityInfo, type BinManager, type BinStepConfig, type BinSwap, BinUtils, type BinWeight, type CalculateAddLiquidityAutoFillOption, type CalculateAddLiquidityOption, type CalculateRemoveLiquidityBothOption, type CalculateRemoveLiquidityOnlyOption, CetusDlmmSDK, type ClaimRefFeeOption, type ClosePositionOption, type CollectFeeOption, type CollectRewardAndFeeOption, type CollectRewardOption, type CreatePartnerOption, type CreatePoolAndAddOption, type CreatePoolAndAddWithPriceOption, type CreatePoolOption, DEFAULT_MAX_WEIGHT, DEFAULT_MIN_WEIGHT, type DlmmBasePool, type DlmmConfigs, type DlmmGlobalConfig, type DlmmPool, type DlmmPosition, FEE_PRECISION, type FeeRate, FeeUtils, type GetBinInfoOption, type GetBinInfoResult, type GetPoolBinInfoOption, type GetTotalFeeRateOption, type IlmInputOptions, type IlmInputResult, IlmUtils, type InitRewardOption, MAX_BIN_ID, MAX_BIN_PER_POSITION, MAX_FEE_RATE, MIN_BIN_ID, ONE, type OpenAndAddLiquidityOption, type OpenAndAddLiquidityWithPriceOption, type OpenPositionOption, type Partner, PoolModule, type PoolPermissions, type PoolTransactionInfo, type PositionFee, type PositionManager, type PositionReward, type PreSwapOption, type PreSwapQuote, REWARD_PERIOD, REWARD_PERIOD_START_AT, type RemoveLiquidityOption, type Reward, type RewardAccessOption, type RewardInfo, type RewardManager, type RewardPeriodEmission, type RewardPeriodEmissionFormat, type RewardWhiteListOption, SCALE_OFFSET, type SdkOptions, StrategyType, StrategyUtils, type SwapOption, type TokenTable, type UpdatePositionFeeAndRewardsOption, type UpdateRefFeeRateOption, type UpdateTimeRangeOption, type ValidateActiveIdSlippageOption, type VariableParameters, WeightUtils, type WeightsInfo, type WeightsOptions, buildPoolKey, CetusDlmmSDK as default, dlmmMainnet, dlmmTestnet, generateRewardSchedule, getRouterModule, parseBinInfo, parseBinInfoList, parseCurrentRewardPeriodEmission, parseDlmmBasePool, parseDlmmPool, parseDlmmPosition, parseLiquidityShares, parsePartner, parsePoolTransactionInfo, parseRewardPeriodEmission, parseStrategyType, parsedDlmmPosFeeData, parsedDlmmPosRewardData, parsedSwapQuoteData, poolFilterEvenTypes, safeAmount, safeMulAmount };
|