@meteora-ag/dlmm 1.5.3 → 1.5.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/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import * as _coral_xyz_anchor from '@coral-xyz/anchor';
2
2
  import { BN, Program, IdlAccounts, ProgramAccount, IdlTypes, EventParser } from '@coral-xyz/anchor';
3
3
  import * as _solana_web3_js from '@solana/web3.js';
4
- import { PublicKey, AccountMeta, TransactionInstruction, Connection, Transaction, Cluster } from '@solana/web3.js';
4
+ import { PublicKey, AccountMeta, TransactionInstruction, Connection, Transaction, Cluster, AccountInfo } from '@solana/web3.js';
5
5
  import Decimal from 'decimal.js';
6
6
  import { Mint } from '@solana/spl-token';
7
+ import BN$1 from 'bn.js';
7
8
 
8
9
  type LbClmm = {
9
10
  "version": "0.9.0";
@@ -8683,6 +8684,61 @@ declare function getTokenProgramId(lbPairState: LbPair): {
8683
8684
  tokenYProgram: PublicKey;
8684
8685
  };
8685
8686
 
8687
+ interface IPosition {
8688
+ address(): PublicKey;
8689
+ lowerBinId(): BN$1;
8690
+ upperBinId(): BN$1;
8691
+ liquidityShares(): BN$1[];
8692
+ rewardInfos(): UserRewardInfo[];
8693
+ feeInfos(): UserFeeInfo[];
8694
+ lastUpdatedAt(): BN$1;
8695
+ lbPair(): PublicKey;
8696
+ totalClaimedFeeXAmount(): BN$1;
8697
+ totalClaimedFeeYAmount(): BN$1;
8698
+ totalClaimedRewards(): BN$1[];
8699
+ operator(): PublicKey;
8700
+ lockReleasePoint(): BN$1;
8701
+ feeOwner(): PublicKey;
8702
+ owner(): PublicKey;
8703
+ getBinArrayIndexesCoverage(): BN$1[];
8704
+ getBinArrayKeysCoverage(programId: PublicKey): PublicKey[];
8705
+ version(): PositionVersion;
8706
+ }
8707
+ declare function wrapPosition(program: Program<LbClmm>, key: PublicKey, account: AccountInfo<Buffer>): IPosition;
8708
+ declare class PositionV2Wrapper implements IPosition {
8709
+ positionAddress: PublicKey;
8710
+ inner: PositionV2;
8711
+ constructor(positionAddress: PublicKey, inner: PositionV2);
8712
+ address(): PublicKey;
8713
+ totalClaimedRewards(): BN$1[];
8714
+ feeOwner(): PublicKey;
8715
+ lockReleasePoint(): BN$1;
8716
+ operator(): PublicKey;
8717
+ totalClaimedFeeYAmount(): BN$1;
8718
+ totalClaimedFeeXAmount(): BN$1;
8719
+ lbPair(): PublicKey;
8720
+ lowerBinId(): BN$1;
8721
+ upperBinId(): BN$1;
8722
+ liquidityShares(): BN$1[];
8723
+ rewardInfos(): UserRewardInfo[];
8724
+ feeInfos(): UserFeeInfo[];
8725
+ lastUpdatedAt(): BN$1;
8726
+ getBinArrayIndexesCoverage(): BN$1[];
8727
+ getBinArrayKeysCoverage(programId: PublicKey): PublicKey[];
8728
+ version(): PositionVersion;
8729
+ owner(): PublicKey;
8730
+ }
8731
+
8732
+ declare function getBinArrayIndexesCoverage(lowerBinId: BN$1, upperBinId: BN$1): BN$1[];
8733
+ declare function getBinArrayKeysCoverage(lowerBinId: BN$1, upperBinId: BN$1, lbPair: PublicKey, programId: PublicKey): PublicKey[];
8734
+ declare function getBinArrayAccountMetasCoverage(lowerBinId: BN$1, upperBinId: BN$1, lbPair: PublicKey, programId: PublicKey): AccountMeta[];
8735
+ declare function getPositionLowerUpperBinIdWithLiquidity(position: PositionData): {
8736
+ lowerBinId: BN$1;
8737
+ upperBinId: BN$1;
8738
+ } | null;
8739
+ declare function isPositionNoFee(position: PositionData): boolean;
8740
+ declare function isPositionNoReward(position: PositionData): boolean;
8741
+
8686
8742
  declare function chunks<T>(array: T[], size: number): T[][];
8687
8743
  declare function range<T>(min: number, max: number, mapfn: (i: number) => T): T[];
8688
8744
  declare function chunkedFetchMultiplePoolAccount(program: ClmmProgram, pks: PublicKey[], chunkSize?: number): Promise<{
@@ -8842,4 +8898,4 @@ declare const ILM_BASE: PublicKey;
8842
8898
  declare const MAX_EXTRA_BIN_ARRAYS = 3;
8843
8899
  declare const U64_MAX: BN;
8844
8900
 
8845
- export { ADMIN, ActionType, ActivationType, BASIS_POINT_MAX, BIN_ARRAY_BITMAP_FEE, BIN_ARRAY_BITMAP_FEE_BN, BIN_ARRAY_BITMAP_SIZE, BIN_ARRAY_FEE, BIN_ARRAY_FEE_BN, Bin, BinAndAmount, BinArray, BinArrayAccount, BinArrayBitmapExtension, BinArrayBitmapExtensionAccount, BinLiquidity, BinLiquidityDistribution, BinLiquidityReduction, BitmapType, ClmmProgram, Clock, ClockLayout, CompressedBinDepositAmount, CompressedBinDepositAmounts, DLMMError, DlmmSdkError, EXTENSION_BINARRAY_BITMAP_SIZE, EmissionRate, FEE_PRECISION, FeeInfo, GetOrCreateATAResponse, IAccountsCache, IDL, ILM_BASE, InitCustomizablePermissionlessPairIx, InitPermissionPairIx, LBCLMM_PROGRAM_IDS, LMRewards, LbClmm, LbPair, LbPairAccount, LbPosition, LiquidityOneSideParameter, LiquidityParameter, LiquidityParameterByStrategy, LiquidityParameterByStrategyOneSide, LiquidityParameterByWeight, MAX_ACTIVE_BIN_SLIPPAGE, MAX_BIN_ARRAY_SIZE, MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX, MAX_BIN_PER_POSITION, MAX_BIN_PER_TX, MAX_CLAIM_ALL_ALLOWED, MAX_EXTRA_BIN_ARRAYS, MAX_FEE_RATE, MEMO_PROGRAM_ID, Network, POOL_FEE, POOL_FEE_BN, POSITION_FEE, POSITION_FEE_BN, POSITION_V2_DISC, PRECISION, PairLockInfo, PairStatus, PairType, Position, PositionBinData, PositionData, PositionInfo, PositionLockInfo, PositionV2, PositionVersion, PresetParameter, PresetParameter2, ProgramStrategyParameter, ProgramStrategyType, RemainingAccountInfo, RemainingAccountsInfoSlice, SCALE, SCALE_OFFSET, SIMULATION_USER, SeedLiquidityCostBreakdown, SeedLiquidityResponse, SeedLiquiditySingleBinResponse, Strategy, StrategyParameters, StrategyType, SwapExactOutParams, SwapFee, SwapParams, SwapQuote, SwapQuoteExactOut, SwapWithPriceImpactParams, TInitializePositionAndAddLiquidityParams, TInitializePositionAndAddLiquidityParamsByStrategy, TOKEN_ACCOUNT_FEE, TOKEN_ACCOUNT_FEE_BN, TQuoteCreatePositionParams, TokenReserve, U64_MAX, UserFeeInfo, UserRewardInfo, autoFillXByStrategy, autoFillXByWeight, autoFillYByStrategy, autoFillYByWeight, binIdToBinArrayIndex, calculateBidAskDistribution, calculateNormalDistribution, calculateSpotDistribution, chunkedFetchMultipleBinArrayBitmapExtensionAccount, chunkedFetchMultiplePoolAccount, chunkedGetMultipleAccountInfos, chunks, computeFee, computeFeeFromAmount, computeProtocolFee, DLMM as default, deriveBinArray, deriveBinArrayBitmapExtension, deriveCustomizablePermissionlessLbPair, deriveEventAuthority, deriveLbPair, deriveLbPair2, deriveLbPairWithPresetParamWithIndexKey, deriveOracle, derivePermissionLbPair, derivePosition, derivePresetParameter, derivePresetParameter2, derivePresetParameterWithIndex, deriveReserve, deriveRewardVault, deriveTokenBadge, enumerateBins, findNextBinArrayIndexWithLiquidity, findNextBinArrayWithLiquidity, fromWeightDistributionToAmount, fromWeightDistributionToAmountOneSide, getBaseFee, getBinArrayLowerUpperBinId, getBinArraysRequiredByPositionRange, getBinFromBinArray, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getOrCreateATAInstruction, getOutAmount, getPriceOfBinByBinId, getTokenBalance, getTokenDecimals, getTokenProgramId, getTokensMintFromPoolAddress, getTotalFee, getVariableFee, isBinIdWithinBinArray, isOverflowDefaultBinArrayBitmap, parseLogs, range, sParameters, swapExactInQuoteAtBin, swapExactOutQuoteAtBin, toAmountAskSide, toAmountBidSide, toAmountBothSide, toAmountsBothSideByStrategy, toStrategyParameters, toWeightDistribution, unwrapSOLInstruction, vParameters, wrapSOLInstruction };
8901
+ export { ADMIN, ActionType, ActivationType, BASIS_POINT_MAX, BIN_ARRAY_BITMAP_FEE, BIN_ARRAY_BITMAP_FEE_BN, BIN_ARRAY_BITMAP_SIZE, BIN_ARRAY_FEE, BIN_ARRAY_FEE_BN, Bin, BinAndAmount, BinArray, BinArrayAccount, BinArrayBitmapExtension, BinArrayBitmapExtensionAccount, BinLiquidity, BinLiquidityDistribution, BinLiquidityReduction, BitmapType, ClmmProgram, Clock, ClockLayout, CompressedBinDepositAmount, CompressedBinDepositAmounts, DLMMError, DlmmSdkError, EXTENSION_BINARRAY_BITMAP_SIZE, EmissionRate, FEE_PRECISION, FeeInfo, GetOrCreateATAResponse, IAccountsCache, IDL, ILM_BASE, IPosition, InitCustomizablePermissionlessPairIx, InitPermissionPairIx, LBCLMM_PROGRAM_IDS, LMRewards, LbClmm, LbPair, LbPairAccount, LbPosition, LiquidityOneSideParameter, LiquidityParameter, LiquidityParameterByStrategy, LiquidityParameterByStrategyOneSide, LiquidityParameterByWeight, MAX_ACTIVE_BIN_SLIPPAGE, MAX_BIN_ARRAY_SIZE, MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX, MAX_BIN_PER_POSITION, MAX_BIN_PER_TX, MAX_CLAIM_ALL_ALLOWED, MAX_EXTRA_BIN_ARRAYS, MAX_FEE_RATE, MEMO_PROGRAM_ID, Network, POOL_FEE, POOL_FEE_BN, POSITION_FEE, POSITION_FEE_BN, POSITION_V2_DISC, PRECISION, PairLockInfo, PairStatus, PairType, Position, PositionBinData, PositionData, PositionInfo, PositionLockInfo, PositionV2, PositionV2Wrapper, PositionVersion, PresetParameter, PresetParameter2, ProgramStrategyParameter, ProgramStrategyType, RemainingAccountInfo, RemainingAccountsInfoSlice, SCALE, SCALE_OFFSET, SIMULATION_USER, SeedLiquidityCostBreakdown, SeedLiquidityResponse, SeedLiquiditySingleBinResponse, Strategy, StrategyParameters, StrategyType, SwapExactOutParams, SwapFee, SwapParams, SwapQuote, SwapQuoteExactOut, SwapWithPriceImpactParams, TInitializePositionAndAddLiquidityParams, TInitializePositionAndAddLiquidityParamsByStrategy, TOKEN_ACCOUNT_FEE, TOKEN_ACCOUNT_FEE_BN, TQuoteCreatePositionParams, TokenReserve, U64_MAX, UserFeeInfo, UserRewardInfo, autoFillXByStrategy, autoFillXByWeight, autoFillYByStrategy, autoFillYByWeight, binIdToBinArrayIndex, calculateBidAskDistribution, calculateNormalDistribution, calculateSpotDistribution, chunkedFetchMultipleBinArrayBitmapExtensionAccount, chunkedFetchMultiplePoolAccount, chunkedGetMultipleAccountInfos, chunks, computeFee, computeFeeFromAmount, computeProtocolFee, DLMM as default, deriveBinArray, deriveBinArrayBitmapExtension, deriveCustomizablePermissionlessLbPair, deriveEventAuthority, deriveLbPair, deriveLbPair2, deriveLbPairWithPresetParamWithIndexKey, deriveOracle, derivePermissionLbPair, derivePosition, derivePresetParameter, derivePresetParameter2, derivePresetParameterWithIndex, deriveReserve, deriveRewardVault, deriveTokenBadge, enumerateBins, findNextBinArrayIndexWithLiquidity, findNextBinArrayWithLiquidity, fromWeightDistributionToAmount, fromWeightDistributionToAmountOneSide, getBaseFee, getBinArrayAccountMetasCoverage, getBinArrayIndexesCoverage, getBinArrayKeysCoverage, getBinArrayLowerUpperBinId, getBinArraysRequiredByPositionRange, getBinFromBinArray, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getOrCreateATAInstruction, getOutAmount, getPositionLowerUpperBinIdWithLiquidity, getPriceOfBinByBinId, getTokenBalance, getTokenDecimals, getTokenProgramId, getTokensMintFromPoolAddress, getTotalFee, getVariableFee, isBinIdWithinBinArray, isOverflowDefaultBinArrayBitmap, isPositionNoFee, isPositionNoReward, parseLogs, range, sParameters, swapExactInQuoteAtBin, swapExactOutQuoteAtBin, toAmountAskSide, toAmountBidSide, toAmountBothSide, toAmountsBothSideByStrategy, toStrategyParameters, toWeightDistribution, unwrapSOLInstruction, vParameters, wrapPosition, wrapSOLInstruction };
package/dist/index.js CHANGED
@@ -9910,6 +9910,131 @@ function getTokenProgramId(lbPairState) {
9910
9910
  };
9911
9911
  }
9912
9912
 
9913
+ // src/dlmm/helpers/positions/index.ts
9914
+
9915
+
9916
+ // src/dlmm/helpers/positions/wrapper.ts
9917
+
9918
+ function wrapPosition(program, key, account) {
9919
+ const disc = account.data.subarray(0, 8);
9920
+ if (disc.equals(POSITION_V2_DISC)) {
9921
+ const state = program.coder.accounts.decode(
9922
+ program.account.positionV2.idlAccount.name,
9923
+ account.data
9924
+ );
9925
+ return new PositionV2Wrapper(key, state);
9926
+ } else {
9927
+ throw new Error("Unknown position account");
9928
+ }
9929
+ }
9930
+ var PositionV2Wrapper = class {
9931
+ constructor(positionAddress, inner) {
9932
+ this.positionAddress = positionAddress;
9933
+ this.inner = inner;
9934
+ }
9935
+ address() {
9936
+ return this.positionAddress;
9937
+ }
9938
+ totalClaimedRewards() {
9939
+ return this.inner.totalClaimedRewards;
9940
+ }
9941
+ feeOwner() {
9942
+ return this.inner.feeOwner;
9943
+ }
9944
+ lockReleasePoint() {
9945
+ return this.inner.lockReleasePoint;
9946
+ }
9947
+ operator() {
9948
+ return this.inner.operator;
9949
+ }
9950
+ totalClaimedFeeYAmount() {
9951
+ return this.inner.totalClaimedFeeYAmount;
9952
+ }
9953
+ totalClaimedFeeXAmount() {
9954
+ return this.inner.totalClaimedFeeXAmount;
9955
+ }
9956
+ lbPair() {
9957
+ return this.inner.lbPair;
9958
+ }
9959
+ lowerBinId() {
9960
+ return new (0, _bnjs2.default)(this.inner.lowerBinId);
9961
+ }
9962
+ upperBinId() {
9963
+ return new (0, _bnjs2.default)(this.inner.upperBinId);
9964
+ }
9965
+ liquidityShares() {
9966
+ return this.inner.liquidityShares;
9967
+ }
9968
+ rewardInfos() {
9969
+ return this.inner.rewardInfos;
9970
+ }
9971
+ feeInfos() {
9972
+ return this.inner.feeInfos;
9973
+ }
9974
+ lastUpdatedAt() {
9975
+ return this.inner.lastUpdatedAt;
9976
+ }
9977
+ getBinArrayIndexesCoverage() {
9978
+ const lowerBinArrayIndex = binIdToBinArrayIndex(this.lowerBinId());
9979
+ const upperBinArrayIndex = lowerBinArrayIndex.add(new (0, _bnjs2.default)(1));
9980
+ return [lowerBinArrayIndex, upperBinArrayIndex];
9981
+ }
9982
+ getBinArrayKeysCoverage(programId) {
9983
+ return this.getBinArrayIndexesCoverage().map(
9984
+ (index) => deriveBinArray(this.lbPair(), index, programId)[0]
9985
+ );
9986
+ }
9987
+ version() {
9988
+ return 1 /* V2 */;
9989
+ }
9990
+ owner() {
9991
+ return this.inner.owner;
9992
+ }
9993
+ };
9994
+
9995
+ // src/dlmm/helpers/positions/index.ts
9996
+ function getBinArrayIndexesCoverage(lowerBinId, upperBinId) {
9997
+ const lowerBinArrayIndex = binIdToBinArrayIndex(lowerBinId);
9998
+ const upperBinArrayIndex = binIdToBinArrayIndex(upperBinId);
9999
+ const binArrayIndexes = [];
10000
+ for (let i = lowerBinArrayIndex.toNumber(); i <= upperBinArrayIndex.toNumber(); i++) {
10001
+ binArrayIndexes.push(new (0, _bnjs2.default)(i));
10002
+ }
10003
+ return binArrayIndexes;
10004
+ }
10005
+ function getBinArrayKeysCoverage(lowerBinId, upperBinId, lbPair, programId) {
10006
+ const binArrayIndexes = getBinArrayIndexesCoverage(lowerBinId, upperBinId);
10007
+ return binArrayIndexes.map((index) => {
10008
+ return deriveBinArray(lbPair, index, programId)[0];
10009
+ });
10010
+ }
10011
+ function getBinArrayAccountMetasCoverage(lowerBinId, upperBinId, lbPair, programId) {
10012
+ return getBinArrayKeysCoverage(lowerBinId, upperBinId, lbPair, programId).map(
10013
+ (key) => {
10014
+ return {
10015
+ pubkey: key,
10016
+ isSigner: false,
10017
+ isWritable: true
10018
+ };
10019
+ }
10020
+ );
10021
+ }
10022
+ function getPositionLowerUpperBinIdWithLiquidity(position) {
10023
+ const binWithLiquidity = position.positionBinData.filter(
10024
+ (b) => !new (0, _bnjs2.default)(b.binLiquidity).isZero()
10025
+ );
10026
+ return binWithLiquidity.length > 0 ? {
10027
+ lowerBinId: new (0, _bnjs2.default)(binWithLiquidity[0].binId),
10028
+ upperBinId: new (0, _bnjs2.default)(binWithLiquidity[binWithLiquidity.length - 1].binId)
10029
+ } : null;
10030
+ }
10031
+ function isPositionNoFee(position) {
10032
+ return position.feeX.isZero() && position.feeY.isZero();
10033
+ }
10034
+ function isPositionNoReward(position) {
10035
+ return position.rewardOne.isZero() && position.rewardTwo.isZero();
10036
+ }
10037
+
9913
10038
  // src/dlmm/helpers/index.ts
9914
10039
  function chunks(array, size) {
9915
10040
  return Array.apply(0, new Array(Math.ceil(array.length / size))).map(
@@ -10114,122 +10239,6 @@ var positionLbPairFilter = (lbPair) => {
10114
10239
  };
10115
10240
  };
10116
10241
 
10117
- // src/dlmm/helpers/positions/index.ts
10118
-
10119
-
10120
- // src/dlmm/helpers/positions/wrapper.ts
10121
-
10122
- function wrapPosition(program, key, account) {
10123
- const disc = account.data.subarray(0, 8);
10124
- if (disc.equals(POSITION_V2_DISC)) {
10125
- const state = program.coder.accounts.decode(
10126
- program.account.positionV2.idlAccount.name,
10127
- account.data
10128
- );
10129
- return new PositionV2Wrapper(key, state);
10130
- } else {
10131
- throw new Error("Unknown position account");
10132
- }
10133
- }
10134
- var PositionV2Wrapper = class {
10135
- constructor(positionAddress, inner) {
10136
- this.positionAddress = positionAddress;
10137
- this.inner = inner;
10138
- }
10139
- address() {
10140
- return this.positionAddress;
10141
- }
10142
- totalClaimedRewards() {
10143
- return this.inner.totalClaimedRewards;
10144
- }
10145
- feeOwner() {
10146
- return this.inner.feeOwner;
10147
- }
10148
- lockReleasePoint() {
10149
- return this.inner.lockReleasePoint;
10150
- }
10151
- operator() {
10152
- return this.inner.operator;
10153
- }
10154
- totalClaimedFeeYAmount() {
10155
- return this.inner.totalClaimedFeeYAmount;
10156
- }
10157
- totalClaimedFeeXAmount() {
10158
- return this.inner.totalClaimedFeeXAmount;
10159
- }
10160
- lbPair() {
10161
- return this.inner.lbPair;
10162
- }
10163
- lowerBinId() {
10164
- return new (0, _bnjs2.default)(this.inner.lowerBinId);
10165
- }
10166
- upperBinId() {
10167
- return new (0, _bnjs2.default)(this.inner.upperBinId);
10168
- }
10169
- liquidityShares() {
10170
- return this.inner.liquidityShares;
10171
- }
10172
- rewardInfos() {
10173
- return this.inner.rewardInfos;
10174
- }
10175
- feeInfos() {
10176
- return this.inner.feeInfos;
10177
- }
10178
- lastUpdatedAt() {
10179
- return this.inner.lastUpdatedAt;
10180
- }
10181
- getBinArrayIndexesCoverage() {
10182
- const lowerBinArrayIndex = binIdToBinArrayIndex(this.lowerBinId());
10183
- const upperBinArrayIndex = lowerBinArrayIndex.add(new (0, _bnjs2.default)(1));
10184
- return [lowerBinArrayIndex, upperBinArrayIndex];
10185
- }
10186
- getBinArrayKeysCoverage(programId) {
10187
- return this.getBinArrayIndexesCoverage().map(
10188
- (index) => deriveBinArray(this.lbPair(), index, programId)[0]
10189
- );
10190
- }
10191
- version() {
10192
- return 1 /* V2 */;
10193
- }
10194
- owner() {
10195
- return this.inner.owner;
10196
- }
10197
- };
10198
-
10199
- // src/dlmm/helpers/positions/index.ts
10200
- function getBinArrayIndexesCoverage(lowerBinId, upperBinId) {
10201
- const lowerBinArrayIndex = binIdToBinArrayIndex(lowerBinId);
10202
- const upperBinArrayIndex = binIdToBinArrayIndex(upperBinId);
10203
- const binArrayIndexes = [];
10204
- for (let i = lowerBinArrayIndex.toNumber(); i <= upperBinArrayIndex.toNumber(); i++) {
10205
- binArrayIndexes.push(new (0, _bnjs2.default)(i));
10206
- }
10207
- return binArrayIndexes;
10208
- }
10209
- function getBinArrayKeysCoverage(lowerBinId, upperBinId, lbPair, programId) {
10210
- const binArrayIndexes = getBinArrayIndexesCoverage(lowerBinId, upperBinId);
10211
- return binArrayIndexes.map((index) => {
10212
- return deriveBinArray(lbPair, index, programId)[0];
10213
- });
10214
- }
10215
- function getBinArrayAccountMetasCoverage(lowerBinId, upperBinId, lbPair, programId) {
10216
- return getBinArrayKeysCoverage(lowerBinId, upperBinId, lbPair, programId).map(
10217
- (key) => {
10218
- return {
10219
- pubkey: key,
10220
- isSigner: false,
10221
- isWritable: true
10222
- };
10223
- }
10224
- );
10225
- }
10226
- function isPositionNoFee(position) {
10227
- return position.feeX.isZero() && position.feeY.isZero();
10228
- }
10229
- function isPositionNoReward(position) {
10230
- return position.rewardOne.isZero() && position.rewardTwo.isZero();
10231
- }
10232
-
10233
10242
  // src/dlmm/index.ts
10234
10243
 
10235
10244
  var DLMM = class {
@@ -13320,7 +13329,7 @@ var DLMM = class {
13320
13329
  ),
13321
13330
  swapForY
13322
13331
  );
13323
- const priceImpact = new (0, _decimaljs2.default)(totalOutAmount.toString()).sub(new (0, _decimaljs2.default)(outAmountWithoutSlippage.toString())).div(new (0, _decimaljs2.default)(outAmountWithoutSlippage.toString())).mul(new (0, _decimaljs2.default)(100));
13332
+ const priceImpact = new (0, _decimaljs2.default)(totalOutAmount.toString()).sub(new (0, _decimaljs2.default)(outAmountWithoutSlippage.toString())).div(new (0, _decimaljs2.default)(outAmountWithoutSlippage.toString())).mul(new (0, _decimaljs2.default)(100)).abs();
13324
13333
  const endPrice = getPriceOfBinByBinId(
13325
13334
  lastFilledActiveBinId.toNumber(),
13326
13335
  this.lbPair.binStep
@@ -15413,5 +15422,13 @@ var src_default = DLMM;
15413
15422
 
15414
15423
 
15415
15424
 
15416
- exports.ADMIN = ADMIN; exports.ActionType = ActionType; exports.ActivationType = ActivationType; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.BIN_ARRAY_BITMAP_FEE = BIN_ARRAY_BITMAP_FEE; exports.BIN_ARRAY_BITMAP_FEE_BN = BIN_ARRAY_BITMAP_FEE_BN; exports.BIN_ARRAY_BITMAP_SIZE = BIN_ARRAY_BITMAP_SIZE; exports.BIN_ARRAY_FEE = BIN_ARRAY_FEE; exports.BIN_ARRAY_FEE_BN = BIN_ARRAY_FEE_BN; exports.BinLiquidity = BinLiquidity; exports.BitmapType = BitmapType; exports.ClockLayout = ClockLayout; exports.DLMMError = DLMMError; exports.DlmmSdkError = DlmmSdkError; exports.EXTENSION_BINARRAY_BITMAP_SIZE = EXTENSION_BINARRAY_BITMAP_SIZE; exports.FEE_PRECISION = FEE_PRECISION; exports.IDL = IDL; exports.ILM_BASE = ILM_BASE; exports.LBCLMM_PROGRAM_IDS = LBCLMM_PROGRAM_IDS; exports.MAX_ACTIVE_BIN_SLIPPAGE = MAX_ACTIVE_BIN_SLIPPAGE; exports.MAX_BIN_ARRAY_SIZE = MAX_BIN_ARRAY_SIZE; exports.MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX = MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX; exports.MAX_BIN_PER_POSITION = MAX_BIN_PER_POSITION; exports.MAX_BIN_PER_TX = MAX_BIN_PER_TX; exports.MAX_CLAIM_ALL_ALLOWED = MAX_CLAIM_ALL_ALLOWED; exports.MAX_EXTRA_BIN_ARRAYS = MAX_EXTRA_BIN_ARRAYS; exports.MAX_FEE_RATE = MAX_FEE_RATE; exports.MEMO_PROGRAM_ID = MEMO_PROGRAM_ID; exports.Network = Network; exports.POOL_FEE = POOL_FEE; exports.POOL_FEE_BN = POOL_FEE_BN; exports.POSITION_FEE = POSITION_FEE; exports.POSITION_FEE_BN = POSITION_FEE_BN; exports.POSITION_V2_DISC = POSITION_V2_DISC; exports.PRECISION = PRECISION; exports.PairStatus = PairStatus; exports.PairType = PairType; exports.PositionVersion = PositionVersion; exports.SCALE = SCALE; exports.SCALE_OFFSET = SCALE_OFFSET; exports.SIMULATION_USER = SIMULATION_USER; exports.Strategy = Strategy; exports.StrategyType = StrategyType; exports.TOKEN_ACCOUNT_FEE = TOKEN_ACCOUNT_FEE; exports.TOKEN_ACCOUNT_FEE_BN = TOKEN_ACCOUNT_FEE_BN; exports.U64_MAX = U64_MAX; exports.autoFillXByStrategy = autoFillXByStrategy; exports.autoFillXByWeight = autoFillXByWeight; exports.autoFillYByStrategy = autoFillYByStrategy; exports.autoFillYByWeight = autoFillYByWeight; exports.binIdToBinArrayIndex = binIdToBinArrayIndex; exports.calculateBidAskDistribution = calculateBidAskDistribution; exports.calculateNormalDistribution = calculateNormalDistribution; exports.calculateSpotDistribution = calculateSpotDistribution; exports.chunkedFetchMultipleBinArrayBitmapExtensionAccount = chunkedFetchMultipleBinArrayBitmapExtensionAccount; exports.chunkedFetchMultiplePoolAccount = chunkedFetchMultiplePoolAccount; exports.chunkedGetMultipleAccountInfos = chunkedGetMultipleAccountInfos; exports.chunks = chunks; exports.computeFee = computeFee; exports.computeFeeFromAmount = computeFeeFromAmount; exports.computeProtocolFee = computeProtocolFee; exports.default = src_default; exports.deriveBinArray = deriveBinArray; exports.deriveBinArrayBitmapExtension = deriveBinArrayBitmapExtension; exports.deriveCustomizablePermissionlessLbPair = deriveCustomizablePermissionlessLbPair; exports.deriveEventAuthority = deriveEventAuthority; exports.deriveLbPair = deriveLbPair; exports.deriveLbPair2 = deriveLbPair2; exports.deriveLbPairWithPresetParamWithIndexKey = deriveLbPairWithPresetParamWithIndexKey; exports.deriveOracle = deriveOracle; exports.derivePermissionLbPair = derivePermissionLbPair; exports.derivePosition = derivePosition; exports.derivePresetParameter = derivePresetParameter; exports.derivePresetParameter2 = derivePresetParameter2; exports.derivePresetParameterWithIndex = derivePresetParameterWithIndex; exports.deriveReserve = deriveReserve; exports.deriveRewardVault = deriveRewardVault; exports.deriveTokenBadge = deriveTokenBadge; exports.enumerateBins = enumerateBins; exports.findNextBinArrayIndexWithLiquidity = findNextBinArrayIndexWithLiquidity; exports.findNextBinArrayWithLiquidity = findNextBinArrayWithLiquidity; exports.fromWeightDistributionToAmount = fromWeightDistributionToAmount; exports.fromWeightDistributionToAmountOneSide = fromWeightDistributionToAmountOneSide; exports.getBaseFee = getBaseFee; exports.getBinArrayLowerUpperBinId = getBinArrayLowerUpperBinId; exports.getBinArraysRequiredByPositionRange = getBinArraysRequiredByPositionRange; exports.getBinFromBinArray = getBinFromBinArray; exports.getEstimatedComputeUnitIxWithBuffer = getEstimatedComputeUnitIxWithBuffer; exports.getEstimatedComputeUnitUsageWithBuffer = getEstimatedComputeUnitUsageWithBuffer; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getOutAmount = getOutAmount; exports.getPriceOfBinByBinId = getPriceOfBinByBinId; exports.getTokenBalance = getTokenBalance; exports.getTokenDecimals = getTokenDecimals; exports.getTokenProgramId = getTokenProgramId; exports.getTokensMintFromPoolAddress = getTokensMintFromPoolAddress; exports.getTotalFee = getTotalFee; exports.getVariableFee = getVariableFee; exports.isBinIdWithinBinArray = isBinIdWithinBinArray; exports.isOverflowDefaultBinArrayBitmap = isOverflowDefaultBinArrayBitmap; exports.parseLogs = parseLogs; exports.range = range; exports.swapExactInQuoteAtBin = swapExactInQuoteAtBin; exports.swapExactOutQuoteAtBin = swapExactOutQuoteAtBin; exports.toAmountAskSide = toAmountAskSide; exports.toAmountBidSide = toAmountBidSide; exports.toAmountBothSide = toAmountBothSide; exports.toAmountsBothSideByStrategy = toAmountsBothSideByStrategy; exports.toStrategyParameters = toStrategyParameters; exports.toWeightDistribution = toWeightDistribution; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.wrapSOLInstruction = wrapSOLInstruction;
15425
+
15426
+
15427
+
15428
+
15429
+
15430
+
15431
+
15432
+
15433
+ exports.ADMIN = ADMIN; exports.ActionType = ActionType; exports.ActivationType = ActivationType; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.BIN_ARRAY_BITMAP_FEE = BIN_ARRAY_BITMAP_FEE; exports.BIN_ARRAY_BITMAP_FEE_BN = BIN_ARRAY_BITMAP_FEE_BN; exports.BIN_ARRAY_BITMAP_SIZE = BIN_ARRAY_BITMAP_SIZE; exports.BIN_ARRAY_FEE = BIN_ARRAY_FEE; exports.BIN_ARRAY_FEE_BN = BIN_ARRAY_FEE_BN; exports.BinLiquidity = BinLiquidity; exports.BitmapType = BitmapType; exports.ClockLayout = ClockLayout; exports.DLMMError = DLMMError; exports.DlmmSdkError = DlmmSdkError; exports.EXTENSION_BINARRAY_BITMAP_SIZE = EXTENSION_BINARRAY_BITMAP_SIZE; exports.FEE_PRECISION = FEE_PRECISION; exports.IDL = IDL; exports.ILM_BASE = ILM_BASE; exports.LBCLMM_PROGRAM_IDS = LBCLMM_PROGRAM_IDS; exports.MAX_ACTIVE_BIN_SLIPPAGE = MAX_ACTIVE_BIN_SLIPPAGE; exports.MAX_BIN_ARRAY_SIZE = MAX_BIN_ARRAY_SIZE; exports.MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX = MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX; exports.MAX_BIN_PER_POSITION = MAX_BIN_PER_POSITION; exports.MAX_BIN_PER_TX = MAX_BIN_PER_TX; exports.MAX_CLAIM_ALL_ALLOWED = MAX_CLAIM_ALL_ALLOWED; exports.MAX_EXTRA_BIN_ARRAYS = MAX_EXTRA_BIN_ARRAYS; exports.MAX_FEE_RATE = MAX_FEE_RATE; exports.MEMO_PROGRAM_ID = MEMO_PROGRAM_ID; exports.Network = Network; exports.POOL_FEE = POOL_FEE; exports.POOL_FEE_BN = POOL_FEE_BN; exports.POSITION_FEE = POSITION_FEE; exports.POSITION_FEE_BN = POSITION_FEE_BN; exports.POSITION_V2_DISC = POSITION_V2_DISC; exports.PRECISION = PRECISION; exports.PairStatus = PairStatus; exports.PairType = PairType; exports.PositionV2Wrapper = PositionV2Wrapper; exports.PositionVersion = PositionVersion; exports.SCALE = SCALE; exports.SCALE_OFFSET = SCALE_OFFSET; exports.SIMULATION_USER = SIMULATION_USER; exports.Strategy = Strategy; exports.StrategyType = StrategyType; exports.TOKEN_ACCOUNT_FEE = TOKEN_ACCOUNT_FEE; exports.TOKEN_ACCOUNT_FEE_BN = TOKEN_ACCOUNT_FEE_BN; exports.U64_MAX = U64_MAX; exports.autoFillXByStrategy = autoFillXByStrategy; exports.autoFillXByWeight = autoFillXByWeight; exports.autoFillYByStrategy = autoFillYByStrategy; exports.autoFillYByWeight = autoFillYByWeight; exports.binIdToBinArrayIndex = binIdToBinArrayIndex; exports.calculateBidAskDistribution = calculateBidAskDistribution; exports.calculateNormalDistribution = calculateNormalDistribution; exports.calculateSpotDistribution = calculateSpotDistribution; exports.chunkedFetchMultipleBinArrayBitmapExtensionAccount = chunkedFetchMultipleBinArrayBitmapExtensionAccount; exports.chunkedFetchMultiplePoolAccount = chunkedFetchMultiplePoolAccount; exports.chunkedGetMultipleAccountInfos = chunkedGetMultipleAccountInfos; exports.chunks = chunks; exports.computeFee = computeFee; exports.computeFeeFromAmount = computeFeeFromAmount; exports.computeProtocolFee = computeProtocolFee; exports.default = src_default; exports.deriveBinArray = deriveBinArray; exports.deriveBinArrayBitmapExtension = deriveBinArrayBitmapExtension; exports.deriveCustomizablePermissionlessLbPair = deriveCustomizablePermissionlessLbPair; exports.deriveEventAuthority = deriveEventAuthority; exports.deriveLbPair = deriveLbPair; exports.deriveLbPair2 = deriveLbPair2; exports.deriveLbPairWithPresetParamWithIndexKey = deriveLbPairWithPresetParamWithIndexKey; exports.deriveOracle = deriveOracle; exports.derivePermissionLbPair = derivePermissionLbPair; exports.derivePosition = derivePosition; exports.derivePresetParameter = derivePresetParameter; exports.derivePresetParameter2 = derivePresetParameter2; exports.derivePresetParameterWithIndex = derivePresetParameterWithIndex; exports.deriveReserve = deriveReserve; exports.deriveRewardVault = deriveRewardVault; exports.deriveTokenBadge = deriveTokenBadge; exports.enumerateBins = enumerateBins; exports.findNextBinArrayIndexWithLiquidity = findNextBinArrayIndexWithLiquidity; exports.findNextBinArrayWithLiquidity = findNextBinArrayWithLiquidity; exports.fromWeightDistributionToAmount = fromWeightDistributionToAmount; exports.fromWeightDistributionToAmountOneSide = fromWeightDistributionToAmountOneSide; exports.getBaseFee = getBaseFee; exports.getBinArrayAccountMetasCoverage = getBinArrayAccountMetasCoverage; exports.getBinArrayIndexesCoverage = getBinArrayIndexesCoverage; exports.getBinArrayKeysCoverage = getBinArrayKeysCoverage; exports.getBinArrayLowerUpperBinId = getBinArrayLowerUpperBinId; exports.getBinArraysRequiredByPositionRange = getBinArraysRequiredByPositionRange; exports.getBinFromBinArray = getBinFromBinArray; exports.getEstimatedComputeUnitIxWithBuffer = getEstimatedComputeUnitIxWithBuffer; exports.getEstimatedComputeUnitUsageWithBuffer = getEstimatedComputeUnitUsageWithBuffer; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getOutAmount = getOutAmount; exports.getPositionLowerUpperBinIdWithLiquidity = getPositionLowerUpperBinIdWithLiquidity; exports.getPriceOfBinByBinId = getPriceOfBinByBinId; exports.getTokenBalance = getTokenBalance; exports.getTokenDecimals = getTokenDecimals; exports.getTokenProgramId = getTokenProgramId; exports.getTokensMintFromPoolAddress = getTokensMintFromPoolAddress; exports.getTotalFee = getTotalFee; exports.getVariableFee = getVariableFee; exports.isBinIdWithinBinArray = isBinIdWithinBinArray; exports.isOverflowDefaultBinArrayBitmap = isOverflowDefaultBinArrayBitmap; exports.isPositionNoFee = isPositionNoFee; exports.isPositionNoReward = isPositionNoReward; exports.parseLogs = parseLogs; exports.range = range; exports.swapExactInQuoteAtBin = swapExactInQuoteAtBin; exports.swapExactOutQuoteAtBin = swapExactOutQuoteAtBin; exports.toAmountAskSide = toAmountAskSide; exports.toAmountBidSide = toAmountBidSide; exports.toAmountBothSide = toAmountBothSide; exports.toAmountsBothSideByStrategy = toAmountsBothSideByStrategy; exports.toStrategyParameters = toStrategyParameters; exports.toWeightDistribution = toWeightDistribution; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.wrapPosition = wrapPosition; exports.wrapSOLInstruction = wrapSOLInstruction;
15417
15434
  //# sourceMappingURL=index.js.map