@cetusprotocol/dlmm-sdk 0.0.6 → 0.0.8

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
@@ -281,7 +281,7 @@ console.log('Variable fee:', variableFee)
281
281
  console.log('Variable fee percentage:', d(variableFee).div(d(FEE_PRECISION)).toString())
282
282
  ```
283
283
 
284
- #### Fee Collection
284
+ #### Fee and Reward Collection
285
285
 
286
286
  You can collect fees from your positions in several ways:
287
287
 
@@ -541,6 +541,8 @@ Note: The `amount_a_in_active_bin` and `amount_b_in_active_bin` parameters are u
541
541
  2. Returns the amounts of both tokens in the active bin if it is within range
542
542
  3. Returns undefined if the active bin is outside the range
543
543
 
544
+ ---
545
+
544
546
  2. **BidAsk Strategy**:
545
547
  ```typescript
546
548
  // Similar to Spot strategy but with different strategy_type
@@ -745,17 +747,28 @@ const tx = sdk.Partner.createPartnerPayload({
745
747
 
746
748
  // Update referral fee rate
747
749
  const updateFeeTx = await sdk.Partner.updateRefFeeRatePayload({
748
- partner_id: '0x9d171399393e3cbedffc24269eb606e735fb56fee17c15153eb5e2d5274a3677',
750
+ partner_id: '0x..',
749
751
  ref_fee_rate: 0.02,
750
752
  })
751
753
 
752
754
  // Update time range
753
755
  const start_time = Math.floor(Date.now() / 1000)
754
756
  const updateTimeTx = await sdk.Partner.updateTimeRangePayload({
755
- partner_id: '0x9d171399393e3cbedffc24269eb606e735fb56fee17c15153eb5e2d5274a3677',
757
+ partner_id: '0x..',
756
758
  start_time,
757
759
  end_time: start_time + 10 * 7 * 24 * 3600,
758
760
  })
761
+
762
+ // claim ref fee
763
+ const tx = await sdk.Position.claimRefFeePayload({
764
+ partner_id: "0x..",
765
+ partner_cap_id: "0x..", // Optional parameter
766
+ fee_coin_types: [coin_type]
767
+ })
768
+
769
+ // Simulate or send the transaction
770
+ const sim_result = await sdk.FullClient.sendSimulationTransaction(tx, wallet)
771
+
759
772
  ```
760
773
 
761
774
  ### 7. Reward Operations
package/dist/index.d.mts CHANGED
@@ -1023,6 +1023,44 @@ declare class FeeUtils {
1023
1023
  };
1024
1024
  }
1025
1025
 
1026
+ type IlmInputOptions = {
1027
+ curvature: number;
1028
+ initial_price: string;
1029
+ max_price: string;
1030
+ bin_step: number;
1031
+ total_supply: string;
1032
+ pool_share_percentage: number;
1033
+ config: {
1034
+ price_curve_points_num: number;
1035
+ liquidity_distribution_num: number;
1036
+ tokens_table_num: number;
1037
+ price_table_num: number;
1038
+ };
1039
+ };
1040
+ type Axis = {
1041
+ x: string;
1042
+ y: string;
1043
+ };
1044
+ type TokenTable = {
1045
+ withdrawn: string;
1046
+ price: string;
1047
+ usdc_in_pool: string;
1048
+ };
1049
+ type IlmInputResult = {
1050
+ price_curve: Axis[];
1051
+ liquidity_curve: Axis[];
1052
+ dlmm_bins: Axis[];
1053
+ tokens_table: TokenTable[];
1054
+ price_table: TokenTable[];
1055
+ initial_fdv: string;
1056
+ final_fdv: string;
1057
+ usdc_in_pool: string;
1058
+ };
1059
+
1060
+ declare class IlmUtils {
1061
+ static calculateIlm(options: IlmInputOptions): IlmInputResult;
1062
+ }
1063
+
1026
1064
  declare const MAX_BIN_PER_POSITION = 1000;
1027
1065
  declare const MIN_BIN_ID = -443636;
1028
1066
  declare const MAX_BIN_ID = 443636;
@@ -1040,4 +1078,4 @@ declare const dlmmMainnet: SdkOptions;
1040
1078
 
1041
1079
  declare const dlmmTestnet: SdkOptions;
1042
1080
 
1043
- export { type AddLiquidityOption, type AddRewardOption, 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 GetPoolBinInfoOption, type GetTotalFeeRateOption, 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 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 };
1081
+ 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 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 };
package/dist/index.d.ts CHANGED
@@ -1023,6 +1023,44 @@ declare class FeeUtils {
1023
1023
  };
1024
1024
  }
1025
1025
 
1026
+ type IlmInputOptions = {
1027
+ curvature: number;
1028
+ initial_price: string;
1029
+ max_price: string;
1030
+ bin_step: number;
1031
+ total_supply: string;
1032
+ pool_share_percentage: number;
1033
+ config: {
1034
+ price_curve_points_num: number;
1035
+ liquidity_distribution_num: number;
1036
+ tokens_table_num: number;
1037
+ price_table_num: number;
1038
+ };
1039
+ };
1040
+ type Axis = {
1041
+ x: string;
1042
+ y: string;
1043
+ };
1044
+ type TokenTable = {
1045
+ withdrawn: string;
1046
+ price: string;
1047
+ usdc_in_pool: string;
1048
+ };
1049
+ type IlmInputResult = {
1050
+ price_curve: Axis[];
1051
+ liquidity_curve: Axis[];
1052
+ dlmm_bins: Axis[];
1053
+ tokens_table: TokenTable[];
1054
+ price_table: TokenTable[];
1055
+ initial_fdv: string;
1056
+ final_fdv: string;
1057
+ usdc_in_pool: string;
1058
+ };
1059
+
1060
+ declare class IlmUtils {
1061
+ static calculateIlm(options: IlmInputOptions): IlmInputResult;
1062
+ }
1063
+
1026
1064
  declare const MAX_BIN_PER_POSITION = 1000;
1027
1065
  declare const MIN_BIN_ID = -443636;
1028
1066
  declare const MAX_BIN_ID = 443636;
@@ -1040,4 +1078,4 @@ declare const dlmmMainnet: SdkOptions;
1040
1078
 
1041
1079
  declare const dlmmTestnet: SdkOptions;
1042
1080
 
1043
- export { type AddLiquidityOption, type AddRewardOption, 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 GetPoolBinInfoOption, type GetTotalFeeRateOption, 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 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 };
1081
+ 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 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 };