@cetusprotocol/dlmm-sdk 1.2.1 → 1.2.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/README.md CHANGED
@@ -58,11 +58,11 @@ const sdk = CetusDlmmSDK.createSDK({
58
58
  })
59
59
  ```
60
60
 
61
- **Option 4: Use custom SuiClient**
61
+ **Option 4: Use custom SuiGrpcClient**
62
62
  ```typescript
63
- import { SuiClient } from '@mysten/sui/client'
63
+ import { SuiGrpcClient } from '@mysten/sui/client'
64
64
 
65
- const suiClient = new SuiClient({ url: 'YOUR_RPC_URL' })
65
+ const suiClient = new SuiGrpcClient({ 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,7 +1,8 @@
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 { SuiEvent, SuiObjectResponse, DevInspectResults, SuiTransactionBlockResponse } from '@mysten/sui/client';
4
+ import * as _mysten_sui_bcs from '@mysten/sui/bcs';
5
+ import { SuiEvent, DevInspectResults } from '@mysten/sui/jsonRpc';
5
6
  import BN from 'bn.js';
6
7
 
7
8
  type DlmmConfigs = {
@@ -447,7 +448,7 @@ declare class PoolModule implements IModule<CetusDlmmSDK> {
447
448
  getBinInfoList(options: GetBinInfoOption[]): Promise<GetBinInfoResult[]>;
448
449
  getTotalFeeRate(option: GetTotalFeeRateOption): Promise<FeeRate>;
449
450
  getPoolBinInfo(option: GetPoolBinInfoOption): Promise<BinAmount[]>;
450
- getPoolTransactionList({ pool_id, pagination_args, order, full_rpc_url, }: {
451
+ getPoolTransactionList({ pool_id, pagination_args, full_rpc_url, }: {
451
452
  pool_id: string;
452
453
  full_rpc_url?: string;
453
454
  pagination_args: PageQuery;
@@ -510,6 +511,16 @@ declare class PositionModule implements IModule<CetusDlmmSDK> {
510
511
  * @returns The transaction object
511
512
  */
512
513
  collectFeePayload(option: CollectFeeOption, tx?: Transaction): Transaction;
514
+ /**
515
+ * collect fee without transferring the coins to the sender
516
+ * @param option - The option for collecting fee
517
+ * @param tx - The transaction object
518
+ * @returns The transaction object
519
+ */
520
+ collectFeePayloadWithoutTransfer(option: CollectFeeOption, tx: Transaction): {
521
+ fee_a_obj: TransactionObjectArgument;
522
+ fee_b_obj: TransactionObjectArgument;
523
+ };
513
524
  /**
514
525
  * Update the fee and rewards of the position
515
526
  * @param option - The option for updating the fee and rewards of the position
@@ -524,6 +535,9 @@ declare class PositionModule implements IModule<CetusDlmmSDK> {
524
535
  * @returns The transaction object
525
536
  */
526
537
  collectRewardPayload(options: CollectRewardOption[], tx?: Transaction): Transaction;
538
+ collectRewardPayloadWithoutTransfer(options: CollectRewardOption, tx: Transaction): {
539
+ reward_coin_objs: TransactionObjectArgument[];
540
+ };
527
541
  collectRewardAndFeePayload(options: CollectRewardAndFeeOption[], tx?: Transaction): Transaction;
528
542
  /**
529
543
  * Validate the active id slippage
@@ -765,18 +779,18 @@ declare function parseDlmmBasePool(data: SuiEvent): DlmmBasePool;
765
779
  * @param data - The DLMM pool data
766
780
  * @returns The DLMM pool
767
781
  */
768
- declare function parseDlmmPool(data: SuiObjectResponse): DlmmPool;
769
- declare function parsePartner(data: SuiObjectResponse): Partner;
770
- declare function parseDlmmPosition(data: SuiObjectResponse): DlmmPosition;
782
+ declare function parseDlmmPool(data: any): DlmmPool;
783
+ declare function parsePartner(data: any): Partner;
784
+ declare function parseDlmmPosition(data: any): DlmmPosition;
771
785
  declare function parseLiquidityShares(liquidity_shares: string[], bin_step: number, lower_bin_id: number, active_bin: BinAmount): BinLiquidityInfo;
772
- declare function parseBinInfoList(res: DevInspectResults): BinAmount[];
786
+ declare function parseBinInfoList(res: any): BinAmount[];
773
787
  declare function parseBinInfo(fields: any): BinAmount;
774
- declare function parsedDlmmPosFeeData(simulate_res: DevInspectResults): Record<string, PositionFee>;
775
- declare function parsedDlmmPosRewardData(simulate_res: DevInspectResults): Record<string, PositionReward>;
788
+ declare function parsedDlmmPosFeeData(events: any[]): Record<string, PositionFee>;
789
+ declare function parsedDlmmPosRewardData(events: any[]): Record<string, PositionReward>;
776
790
  declare function parsedSwapQuoteData(simulate_res: DevInspectResults, a2b: boolean): PreSwapQuote | undefined;
777
791
  declare function parseStrategyType(strategy_type: StrategyType): number;
778
792
  declare const poolFilterEvenTypes: string[];
779
- declare function parsePoolTransactionInfo(data: SuiTransactionBlockResponse, txIndex: number, package_id: string, pool_id: string): PoolTransactionInfo[];
793
+ declare function parsePoolTransactionInfo(rawData: any, txIndex: number, package_id: string, pool_id: string): PoolTransactionInfo[];
780
794
  declare function generateRewardSchedule(baseTime: number, maxIntervals: number, timeInterval: number): number[];
781
795
  declare function parseRewardPeriodEmission(periodEmissionList: RewardPeriodEmission[], startTimeInSeconds: number, endTimeInSeconds: number, durationSeconds: number): RewardPeriodEmissionFormat[];
782
796
  declare function parseCurrentRewardPeriodEmission(periodEmissionList: RewardPeriodEmission[]): RewardPeriodEmission | undefined;
@@ -784,6 +798,149 @@ declare function safeMulAmount(amount: Decimal, rate: Decimal, verify?: boolean)
784
798
  declare function safeAmount(amount: Decimal, verify?: boolean): Decimal;
785
799
  declare function getRouterModule(strategy_type: StrategyType): "spot" | "curve" | "bid_ask";
786
800
  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>;
787
944
 
788
945
  declare const SCALE_OFFSET = 64;
789
946
  declare const ONE: BN;
@@ -1114,4 +1271,4 @@ declare const dlmmMainnet: SdkOptions;
1114
1271
 
1115
1272
  declare const dlmmTestnet: SdkOptions;
1116
1273
 
1117
- 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 };
1274
+ export { type AddLiquidityOption, type AddRewardOption, type Axis, BASIS_POINT, BASIS_POINT_MAX, BIN_BOUND, type BaseAddLiquidityOption, type BaseCalculateAddLiquidityOption, type BaseCreatePoolAndAddOption, type BaseCreatePoolOption, Bin, type BinAmount, BinGroup, BinGroupRefRaw, 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, NodeIDPoolSimpleInfo, ONE, type OpenAndAddLiquidityOption, type OpenAndAddLiquidityWithPriceOption, type OpenPositionOption, type Partner, PoolModule, type PoolPermissions, PoolSimpleInfoRaw, 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, SkipListNodeBinGroupRefRaw, 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 };