@magmaprotocol/magma-clmm-sdk 0.5.65 → 0.5.66

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 CHANGED
@@ -1851,6 +1851,21 @@ type DlmmPositionInfo = {
1851
1851
  fees: DlmmEventEarnedFees;
1852
1852
  contractPool: DlmmPoolInfo | undefined;
1853
1853
  };
1854
+ type MintByStrategyParams = {
1855
+ pair: string;
1856
+ bin_step: number;
1857
+ coinTypeA: string;
1858
+ coinTypeB: string;
1859
+ amountATotal: number;
1860
+ amountBTotal: number;
1861
+ fixCoinA: boolean;
1862
+ fixCoinB: boolean;
1863
+ strategy: number;
1864
+ min_bin: number;
1865
+ max_bin: number;
1866
+ active_bin: number;
1867
+ slippage: number;
1868
+ };
1854
1869
 
1855
1870
  type BigNumber = Decimal.Value | number | string;
1856
1871
 
@@ -3725,6 +3740,7 @@ declare class DlmmModule implements IModule {
3725
3740
  getPoolInfo(pools: string[]): Promise<DlmmPoolInfo[]>;
3726
3741
  fetchPairParams(params: FetchPairParams): Promise<EventPairParams>;
3727
3742
  createPairPayload(params: CreatePairParams): Promise<Transaction>;
3743
+ mintByStrategy(params: MintByStrategyParams): Promise<Transaction>;
3728
3744
  mintPercent(params: MintPercentParams): Promise<Transaction>;
3729
3745
  createPositionByAmount(params: MintAmountParams): Promise<Transaction>;
3730
3746
  addLiquidity(params: DlmmAddLiquidityParams): Promise<Transaction>;
@@ -3739,11 +3755,11 @@ declare class DlmmModule implements IModule {
3739
3755
  swap(params: DLMMSwapParams): Promise<Transaction>;
3740
3756
  fetchBins(params: FetchBinsParams): Promise<EventBin[]>;
3741
3757
  /**
3742
- * Gets a list of positions for the given account address.
3743
- * @param accountAddress The account address to get positions for.
3744
- * @param assignPoolIds An array of pool IDs to filter the positions by.
3745
- * @returns array of Position objects.
3746
- */
3758
+ * Gets a list of positions for the given account address.
3759
+ * @param accountAddress The account address to get positions for.
3760
+ * @param assignPoolIds An array of pool IDs to filter the positions by.
3761
+ * @returns array of Position objects.
3762
+ */
3747
3763
  getUserPositionById(positionId: string, showDisplay?: boolean): Promise<DlmmPositionInfo>;
3748
3764
  /**
3749
3765
  * Gets a list of positions for the given account address.
@@ -4510,4 +4526,4 @@ interface InitMagmaSDKOptions {
4510
4526
  */
4511
4527
  declare function initMagmaSDK(options: InitMagmaSDKOptions): MagmaClmmSDK;
4512
4528
 
4513
- export { AMM_SWAP_MODULE, AddBribeReward, AddLiquidityCommonParams, AddLiquidityFixTokenParams, AddLiquidityParams, AddLiquidityWithProtectionParams, AddressAndDirection, AdjustResult, AggregatorResult, AmountSpecified, BasePath, BigNumber, BinDisplay, BinLiquidity, BinMath, Bits, BuildCoinResult, CLOCK_ADDRESS, CachedContent, CalculateRatesParams, CalculateRatesResult, ClaimAndLockParams, ClaimFeesParams, ClaimFeesPoolsParams, ClmmConfig, ClmmExpectSwapModule, ClmmFetcherModule, ClmmIntegratePoolModule, ClmmIntegratePoolV2Module, ClmmIntegratePoolV3Module, ClmmIntegrateRouterModule, ClmmIntegrateRouterWithPartnerModule, ClmmIntegrateUtilsModule, ClmmPartnerModule, ClmmPoolConfig, ClmmPoolUtil, ClmmPositionStatus, ClmmpoolData, ClosePositionParams, CoinAmounts, CoinAsset, CoinAssist, CoinConfig, CoinInfoAddress, CoinNode, CoinPairType, CoinProvider, CoinStoreAddress, CollectFeeParams, CollectFeesQuote, CollectFeesQuoteParam, CollectRewarderParams, ConfigModule, CreateLockParams, CreatePairParams, CreatePartnerEvent, CreatePoolAddLiquidityParams, CreatePoolParams, DEFAULT_GAS_BUDGET_FOR_MERGE, DEFAULT_GAS_BUDGET_FOR_SPLIT, DEFAULT_GAS_BUDGET_FOR_STAKE, DEFAULT_GAS_BUDGET_FOR_TRANSFER, DEFAULT_GAS_BUDGET_FOR_TRANSFER_SUI, DEFAULT_NFT_TRANSFER_GAS_FEE, DLMMSwapParams, DataPage, DeepbookClobV2Moudle, DeepbookCustodianV2Moudle, DeepbookEndpointsV2Moudle, DeepbookPool, DeepbookUtils, DepositPosition, DlmmAddLiquidityParams, DlmmBurnPositionParams, DlmmCollectFeeParams, DlmmCollectRewardParams, DlmmConfig, DlmmCreatePairAddLiquidityParams, DlmmEventEarnedFees, DlmmEventEarnedRewards, DlmmEventPairRewardTypes, DlmmPoolInfo, DlmmPosition, DlmmPositionInfo, DlmmRewardsParams, DlmmScript, DlmmShrinkPosition, EpochEmission, EventBin, EventPairLiquidity, EventPairParams, EventPositionLiquidity, FEE_RATE_DENOMINATOR, FaucetCoin, FetchBinsParams, FetchPairParams, FetchParams, GAS_SYMBOL, GAS_TYPE_ARG, GAS_TYPE_ARG_LONG, Gauge, GetPairLiquidityParams, GetPairRewarderParams, GetPositionLiquidityParams, GetRewardByPosition, IncreaseLockAmountParams, IncreaseUnlockTimeParams, LaunchpadPoolConfig, LiquidityAndCoinYResult, LiquidityInput, LockModule, LockPermanentParams, LockVoteEvent, MAX_SQRT_PRICE, MAX_TICK_INDEX, MIN_SQRT_PRICE, MIN_TICK_INDEX, MagmaClmmSDK, MagmaConfigs, MathUtil, MergeLockParams, MintAmountParams, MintPercentParams, Minter, NFT, ONE, OnePath, OpenPositionAddLiquidityWithProtectionParams, OpenPositionParams, Order, POOL_NO_LIQUIDITY, POOL_STRUCT, Package, PageQuery, PaginationArgs, PathLink, PathProvider, Percentage, PokeParams, Pool, PoolImmutables, PoolInfo, PoolModule, Position, PositionModule, PositionReward, PositionStatus, PositionUtil, PreRouterSwapParams, PreSwapLpChangeParams, PreSwapParams, PreSwapResult, PreSwapWithMultiPoolParams, PriceResult, RemoveLiquidityParams, RewardDistributor, Rewarder, RewarderAmountOwed, RouterModule, RouterModuleV2, RpcModule, SUI_SYSTEM_STATE_OBJECT_ID, SdkOptions, SplitPath, SplitSwap, SplitSwapResult, SplitUnit, StakedPositionOfPool, StrategyType, SuiAddressType, SuiBasicTypes, SuiInputTypes, SuiObjectDataWithContent, SuiObjectIdType, SuiResource, SuiStructTag, SuiTxArg, SwapDirection, SwapModule, SwapParams, SwapResult, SwapStepResult, SwapUtils, SwapWithRouterParams, TICK_ARRAY_SIZE, TWO, Tick, TickData, TickMath, TickUtil, TokenConfig, TokenConfigEvent, TokenInfo, TokenModule, TransPreSwapWithMultiPoolParams, TransactionUtil, TransferLockParams, TxBlock, U128, U128_MAX, U64_MAX, VoteParams, Voter, VotingEscrow, WithdrawPosition, ZERO, addHexPrefix, adjustForCoinSlippage, adjustForSlippage, asIntN, asUintN, autoFillXByStrategy, autoFillXByWeight, autoFillYByStrategy, autoFillYByWeight, bufferToHex, buildClmmPositionName, buildNFT, buildPool, buildPosition, buildPositionReward, buildTickData, buildTickDataByEvent, cacheTime24h, cacheTime5min, checkAddress, checkInvalidSuiAddress, clmmMainnet, clmmTestnet, collectFeesQuote, composeType, computeSwap, computeSwapStep, createSplitAmountArray, createSplitArray, createTestTransferTxPayloadParams, d, decimalsMultiplier, MagmaClmmSDK as default, estPoolAPR, estPosAPRResult, estPositionAPRWithDeltaMethod, estPositionAPRWithMultiMethod, estimateLiquidityForCoinA, estimateLiquidityForCoinB, extractAddressFromType, extractStructTagFromType, findAdjustCoin, fixCoinType, fixSuiObjectId, fromDecimalsAmount, getAmountFixedDelta, getAmountUnfixedDelta, getCoinAFromLiquidity, getCoinBFromLiquidity, getCoinXYForLiquidity, getDefaultSuiInputType, getDeltaA, getDeltaB, getDeltaDownFromOutput, getDeltaUpFromInput, getFutureTime, getLiquidityAndCoinYByCoinX, getLiquidityFromCoinA, getLiquidityFromCoinB, getLowerSqrtPriceFromCoinA, getLowerSqrtPriceFromCoinB, getMoveObject, getMoveObjectType, getMovePackageContent, getNearestTickByTick, getNextSqrtPriceAUp, getNextSqrtPriceBDown, getNextSqrtPriceFromInput, getNextSqrtPriceFromOutput, getObjectDeletedResponse, getObjectDisplay, getObjectFields, getObjectId, getObjectNotExistsResponse, getObjectOwner, getObjectPreviousTransactionDigest, getObjectReference, getObjectType, getObjectVersion, getPackagerConfigs, getPriceOfBinByBinId, getRewardInTickRange, getSuiObjectData, getTickDataFromUrlData, getUpperSqrtPriceFromCoinA, getUpperSqrtPriceFromCoinB, hasPublicTransfer, hexToNumber, hexToString, initMagmaSDK, initMainnetSDK, initTestnetSDK, isSortedSymbols, isSuiObjectResponse, newBits, normalizeCoinType, patchFixSuiObjectId, printTransaction, removeHexPrefix, secretKeyToEd25519Keypair, secretKeyToSecp256k1Keypair, shortAddress, shortString, tickScore, toAmountAskSide, toAmountBidSide, toAmountBothSide, toAmountsBothSideByStrategy, toBuffer, toCoinAmount, toDecimalsAmount, transClmmpoolDataWithoutTicks, utf8to16, withLiquiditySlippage };
4529
+ export { AMM_SWAP_MODULE, AddBribeReward, AddLiquidityCommonParams, AddLiquidityFixTokenParams, AddLiquidityParams, AddLiquidityWithProtectionParams, AddressAndDirection, AdjustResult, AggregatorResult, AmountSpecified, BasePath, BigNumber, BinDisplay, BinLiquidity, BinMath, Bits, BuildCoinResult, CLOCK_ADDRESS, CachedContent, CalculateRatesParams, CalculateRatesResult, ClaimAndLockParams, ClaimFeesParams, ClaimFeesPoolsParams, ClmmConfig, ClmmExpectSwapModule, ClmmFetcherModule, ClmmIntegratePoolModule, ClmmIntegratePoolV2Module, ClmmIntegratePoolV3Module, ClmmIntegrateRouterModule, ClmmIntegrateRouterWithPartnerModule, ClmmIntegrateUtilsModule, ClmmPartnerModule, ClmmPoolConfig, ClmmPoolUtil, ClmmPositionStatus, ClmmpoolData, ClosePositionParams, CoinAmounts, CoinAsset, CoinAssist, CoinConfig, CoinInfoAddress, CoinNode, CoinPairType, CoinProvider, CoinStoreAddress, CollectFeeParams, CollectFeesQuote, CollectFeesQuoteParam, CollectRewarderParams, ConfigModule, CreateLockParams, CreatePairParams, CreatePartnerEvent, CreatePoolAddLiquidityParams, CreatePoolParams, DEFAULT_GAS_BUDGET_FOR_MERGE, DEFAULT_GAS_BUDGET_FOR_SPLIT, DEFAULT_GAS_BUDGET_FOR_STAKE, DEFAULT_GAS_BUDGET_FOR_TRANSFER, DEFAULT_GAS_BUDGET_FOR_TRANSFER_SUI, DEFAULT_NFT_TRANSFER_GAS_FEE, DLMMSwapParams, DataPage, DeepbookClobV2Moudle, DeepbookCustodianV2Moudle, DeepbookEndpointsV2Moudle, DeepbookPool, DeepbookUtils, DepositPosition, DlmmAddLiquidityParams, DlmmBurnPositionParams, DlmmCollectFeeParams, DlmmCollectRewardParams, DlmmConfig, DlmmCreatePairAddLiquidityParams, DlmmEventEarnedFees, DlmmEventEarnedRewards, DlmmEventPairRewardTypes, DlmmPoolInfo, DlmmPosition, DlmmPositionInfo, DlmmRewardsParams, DlmmScript, DlmmShrinkPosition, EpochEmission, EventBin, EventPairLiquidity, EventPairParams, EventPositionLiquidity, FEE_RATE_DENOMINATOR, FaucetCoin, FetchBinsParams, FetchPairParams, FetchParams, GAS_SYMBOL, GAS_TYPE_ARG, GAS_TYPE_ARG_LONG, Gauge, GetPairLiquidityParams, GetPairRewarderParams, GetPositionLiquidityParams, GetRewardByPosition, IncreaseLockAmountParams, IncreaseUnlockTimeParams, LaunchpadPoolConfig, LiquidityAndCoinYResult, LiquidityInput, LockModule, LockPermanentParams, LockVoteEvent, MAX_SQRT_PRICE, MAX_TICK_INDEX, MIN_SQRT_PRICE, MIN_TICK_INDEX, MagmaClmmSDK, MagmaConfigs, MathUtil, MergeLockParams, MintAmountParams, MintByStrategyParams, MintPercentParams, Minter, NFT, ONE, OnePath, OpenPositionAddLiquidityWithProtectionParams, OpenPositionParams, Order, POOL_NO_LIQUIDITY, POOL_STRUCT, Package, PageQuery, PaginationArgs, PathLink, PathProvider, Percentage, PokeParams, Pool, PoolImmutables, PoolInfo, PoolModule, Position, PositionModule, PositionReward, PositionStatus, PositionUtil, PreRouterSwapParams, PreSwapLpChangeParams, PreSwapParams, PreSwapResult, PreSwapWithMultiPoolParams, PriceResult, RemoveLiquidityParams, RewardDistributor, Rewarder, RewarderAmountOwed, RouterModule, RouterModuleV2, RpcModule, SUI_SYSTEM_STATE_OBJECT_ID, SdkOptions, SplitPath, SplitSwap, SplitSwapResult, SplitUnit, StakedPositionOfPool, StrategyType, SuiAddressType, SuiBasicTypes, SuiInputTypes, SuiObjectDataWithContent, SuiObjectIdType, SuiResource, SuiStructTag, SuiTxArg, SwapDirection, SwapModule, SwapParams, SwapResult, SwapStepResult, SwapUtils, SwapWithRouterParams, TICK_ARRAY_SIZE, TWO, Tick, TickData, TickMath, TickUtil, TokenConfig, TokenConfigEvent, TokenInfo, TokenModule, TransPreSwapWithMultiPoolParams, TransactionUtil, TransferLockParams, TxBlock, U128, U128_MAX, U64_MAX, VoteParams, Voter, VotingEscrow, WithdrawPosition, ZERO, addHexPrefix, adjustForCoinSlippage, adjustForSlippage, asIntN, asUintN, autoFillXByStrategy, autoFillXByWeight, autoFillYByStrategy, autoFillYByWeight, bufferToHex, buildClmmPositionName, buildNFT, buildPool, buildPosition, buildPositionReward, buildTickData, buildTickDataByEvent, cacheTime24h, cacheTime5min, checkAddress, checkInvalidSuiAddress, clmmMainnet, clmmTestnet, collectFeesQuote, composeType, computeSwap, computeSwapStep, createSplitAmountArray, createSplitArray, createTestTransferTxPayloadParams, d, decimalsMultiplier, MagmaClmmSDK as default, estPoolAPR, estPosAPRResult, estPositionAPRWithDeltaMethod, estPositionAPRWithMultiMethod, estimateLiquidityForCoinA, estimateLiquidityForCoinB, extractAddressFromType, extractStructTagFromType, findAdjustCoin, fixCoinType, fixSuiObjectId, fromDecimalsAmount, getAmountFixedDelta, getAmountUnfixedDelta, getCoinAFromLiquidity, getCoinBFromLiquidity, getCoinXYForLiquidity, getDefaultSuiInputType, getDeltaA, getDeltaB, getDeltaDownFromOutput, getDeltaUpFromInput, getFutureTime, getLiquidityAndCoinYByCoinX, getLiquidityFromCoinA, getLiquidityFromCoinB, getLowerSqrtPriceFromCoinA, getLowerSqrtPriceFromCoinB, getMoveObject, getMoveObjectType, getMovePackageContent, getNearestTickByTick, getNextSqrtPriceAUp, getNextSqrtPriceBDown, getNextSqrtPriceFromInput, getNextSqrtPriceFromOutput, getObjectDeletedResponse, getObjectDisplay, getObjectFields, getObjectId, getObjectNotExistsResponse, getObjectOwner, getObjectPreviousTransactionDigest, getObjectReference, getObjectType, getObjectVersion, getPackagerConfigs, getPriceOfBinByBinId, getRewardInTickRange, getSuiObjectData, getTickDataFromUrlData, getUpperSqrtPriceFromCoinA, getUpperSqrtPriceFromCoinB, hasPublicTransfer, hexToNumber, hexToString, initMagmaSDK, initMainnetSDK, initTestnetSDK, isSortedSymbols, isSuiObjectResponse, newBits, normalizeCoinType, patchFixSuiObjectId, printTransaction, removeHexPrefix, secretKeyToEd25519Keypair, secretKeyToSecp256k1Keypair, shortAddress, shortString, tickScore, toAmountAskSide, toAmountBidSide, toAmountBothSide, toAmountsBothSideByStrategy, toBuffer, toCoinAmount, toDecimalsAmount, transClmmpoolDataWithoutTicks, utf8to16, withLiquiditySlippage };
package/dist/index.js CHANGED
@@ -10725,6 +10725,7 @@ var GaugeModule = class {
10725
10725
  // src/modules/dlmm.ts
10726
10726
  var import_transactions12 = require("@mysten/sui/transactions");
10727
10727
  var import_calc_dlmm3 = require("@magmaprotocol/calc_dlmm");
10728
+ var import_decimal13 = __toESM(require("decimal.js"));
10728
10729
  var DlmmModule = class {
10729
10730
  _sdk;
10730
10731
  _cache = {};
@@ -10799,7 +10800,9 @@ var DlmmModule = class {
10799
10800
  }
10800
10801
  // NOTE: x, y should be sorted
10801
10802
  async createPairPayload(params) {
10802
- const storage_id = (0, import_calc_dlmm3.get_storage_id_from_real_id)(BinMath.getBinIdFromPrice(params.priceTokenBPerTokenA, params.bin_step, params.coinADecimal, params.coinBDecimal));
10803
+ const storage_id = (0, import_calc_dlmm3.get_storage_id_from_real_id)(
10804
+ BinMath.getBinIdFromPrice(params.priceTokenBPerTokenA, params.bin_step, params.coinADecimal, params.coinBDecimal)
10805
+ );
10803
10806
  const tx = new import_transactions12.Transaction();
10804
10807
  tx.setSender(this.sdk.senderAddress);
10805
10808
  const { clmm_pool, dlmm_pool, integrate } = this.sdk.sdkOptions;
@@ -10820,6 +10823,64 @@ var DlmmModule = class {
10820
10823
  });
10821
10824
  return tx;
10822
10825
  }
10826
+ async mintByStrategy(params) {
10827
+ const tx = new import_transactions12.Transaction();
10828
+ const slippage = new import_decimal13.default(params.slippage);
10829
+ const lower_slippage = new import_decimal13.default(1).plus(slippage.div(new import_decimal13.default(1e4)));
10830
+ const upper_slippage = new import_decimal13.default(1).plus(slippage.div(new import_decimal13.default(1e4)));
10831
+ tx.setSender(this.sdk.senderAddress);
10832
+ const { dlmm_pool, integrate } = this.sdk.sdkOptions;
10833
+ const dlmmConfig = getPackagerConfigs(dlmm_pool);
10834
+ const typeArguments = [params.coinTypeA, params.coinTypeB];
10835
+ const price = (0, import_calc_dlmm3.get_price_x128_from_real_id)(params.active_bin, params.bin_step);
10836
+ const min_price = new import_decimal13.default(price).mul(lower_slippage);
10837
+ const max_price = new import_decimal13.default(price).mul(upper_slippage);
10838
+ const active_min = (0, import_calc_dlmm3.get_storage_id_from_real_id)((0, import_calc_dlmm3.get_real_id_from_price_x128)(min_price.toDecimalPlaces(0).toString(), params.bin_step));
10839
+ const active_max = (0, import_calc_dlmm3.get_storage_id_from_real_id)((0, import_calc_dlmm3.get_real_id_from_price_x128)(max_price.toDecimalPlaces(0).toString(), params.bin_step));
10840
+ const allCoins = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress);
10841
+ let primaryCoinAInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountATotal), params.coinTypeA, false, true);
10842
+ let primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountBTotal), params.coinTypeB, false, true);
10843
+ let amount_min = 0;
10844
+ let amount_max = 0;
10845
+ if (params.fixCoinA) {
10846
+ amount_min = new import_decimal13.default(params.amountATotal).mul(lower_slippage).toDecimalPlaces(0).toNumber();
10847
+ amount_max = new import_decimal13.default(params.amountATotal).mul(upper_slippage).toDecimalPlaces(0).toNumber();
10848
+ primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(amount_max), params.coinTypeB, false, true);
10849
+ }
10850
+ if (params.fixCoinB) {
10851
+ amount_min = new import_decimal13.default(params.amountBTotal).mul(lower_slippage).toDecimalPlaces(0).toNumber();
10852
+ amount_max = new import_decimal13.default(params.amountBTotal).mul(upper_slippage).toDecimalPlaces(0).toNumber();
10853
+ primaryCoinAInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(amount_max), params.coinTypeB, false, true);
10854
+ }
10855
+ if (params.fixCoinA && params.fixCoinB) {
10856
+ } else if (params.fixCoinA) {
10857
+ params.amountBTotal = 0;
10858
+ } else if (params.fixCoinB) {
10859
+ params.amountATotal = 0;
10860
+ }
10861
+ const args = [
10862
+ tx.object(params.pair),
10863
+ tx.object(dlmmConfig.factory),
10864
+ primaryCoinAInputs.targetCoin,
10865
+ primaryCoinBInputs.targetCoin,
10866
+ tx.pure.u64(params.amountATotal),
10867
+ tx.pure.u64(params.amountBTotal),
10868
+ tx.pure.u8(params.strategy),
10869
+ tx.pure.u32(params.min_bin),
10870
+ tx.pure.u32(params.max_bin),
10871
+ tx.pure.u32(active_min),
10872
+ tx.pure.u32(active_max),
10873
+ tx.pure.u64(amount_min),
10874
+ tx.pure.u64(amount_max),
10875
+ tx.object(CLOCK_ADDRESS)
10876
+ ];
10877
+ tx.moveCall({
10878
+ target: `${integrate.published_at}::${DlmmScript}::mint_percent`,
10879
+ typeArguments,
10880
+ arguments: args
10881
+ });
10882
+ return tx;
10883
+ }
10823
10884
  // Create a position by percent
10824
10885
  async mintPercent(params) {
10825
10886
  const tx = new import_transactions12.Transaction();
@@ -11071,11 +11132,28 @@ var DlmmModule = class {
11071
11132
  const { clmm_pool, integrate } = this.sdk.sdkOptions;
11072
11133
  const { global_config_id } = getPackagerConfigs(clmm_pool);
11073
11134
  const typeArguments = [params.coinTypeA, params.coinTypeB];
11135
+ const allCoinAsset = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress);
11136
+ const primaryCoinInputA = TransactionUtil.buildCoinForAmount(
11137
+ tx,
11138
+ allCoinAsset,
11139
+ params.swapForY ? BigInt(params.amountIn) : BigInt(0),
11140
+ params.coinTypeA,
11141
+ false,
11142
+ true
11143
+ );
11144
+ const primaryCoinInputB = TransactionUtil.buildCoinForAmount(
11145
+ tx,
11146
+ allCoinAsset,
11147
+ params.swapForY ? BigInt(0) : BigInt(params.amountIn),
11148
+ params.coinTypeB,
11149
+ false,
11150
+ true
11151
+ );
11074
11152
  const args = [
11075
11153
  tx.object(params.pair),
11076
11154
  tx.object(global_config_id),
11077
- tx.object(params.coinTypeA),
11078
- tx.object(params.coinTypeB),
11155
+ primaryCoinInputA.targetCoin,
11156
+ primaryCoinInputB.targetCoin,
11079
11157
  tx.pure.u64(params.amountIn),
11080
11158
  tx.pure.u64(params.minAmountOut),
11081
11159
  tx.pure.bool(params.swapForY),
@@ -11116,11 +11194,11 @@ var DlmmModule = class {
11116
11194
  return res;
11117
11195
  }
11118
11196
  /**
11119
- * Gets a list of positions for the given account address.
11120
- * @param accountAddress The account address to get positions for.
11121
- * @param assignPoolIds An array of pool IDs to filter the positions by.
11122
- * @returns array of Position objects.
11123
- */
11197
+ * Gets a list of positions for the given account address.
11198
+ * @param accountAddress The account address to get positions for.
11199
+ * @param assignPoolIds An array of pool IDs to filter the positions by.
11200
+ * @returns array of Position objects.
11201
+ */
11124
11202
  async getUserPositionById(positionId, showDisplay = true) {
11125
11203
  let position;
11126
11204
  const ownerRes = await this._sdk.fullClient.getObject({
@@ -11386,7 +11464,7 @@ var DlmmModule = class {
11386
11464
  fee_y: 0
11387
11465
  };
11388
11466
  if (simulateRes.error != null) {
11389
- throw new Error(`fetchBins error code: ${simulateRes.error ?? "unknown error"}`);
11467
+ throw new Error(`fetchPairRewards error code: ${simulateRes.error ?? "unknown error"}`);
11390
11468
  }
11391
11469
  simulateRes.events?.forEach((item) => {
11392
11470
  if (extractStructTagFromType(item.type).name === `EventPositionLiquidity`) {