@meteora-ag/dlmm 1.0.30 → 1.0.31

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
@@ -5,7 +5,7 @@ import { PublicKey, TransactionInstruction, Connection, Transaction, Cluster } f
5
5
  import Decimal from 'decimal.js';
6
6
 
7
7
  type LbClmm = {
8
- version: "0.5.0";
8
+ version: "0.5.1";
9
9
  name: "lb_clmm";
10
10
  constants: [
11
11
  {
@@ -1768,39 +1768,6 @@ type LbClmm = {
1768
1768
  }
1769
1769
  ];
1770
1770
  },
1771
- {
1772
- name: "initializePresetParameterV2";
1773
- accounts: [
1774
- {
1775
- name: "presetParameter";
1776
- isMut: true;
1777
- isSigner: false;
1778
- },
1779
- {
1780
- name: "admin";
1781
- isMut: true;
1782
- isSigner: true;
1783
- },
1784
- {
1785
- name: "systemProgram";
1786
- isMut: false;
1787
- isSigner: false;
1788
- },
1789
- {
1790
- name: "rent";
1791
- isMut: false;
1792
- isSigner: false;
1793
- }
1794
- ];
1795
- args: [
1796
- {
1797
- name: "ix";
1798
- type: {
1799
- defined: "InitPresetParametersIx";
1800
- };
1801
- }
1802
- ];
1803
- },
1804
1771
  {
1805
1772
  name: "closePresetParameter";
1806
1773
  accounts: [
@@ -2285,6 +2252,124 @@ type LbClmm = {
2285
2252
  type: "u16";
2286
2253
  }
2287
2254
  ];
2255
+ },
2256
+ {
2257
+ name: "addLiquidityOneSidePrecise";
2258
+ accounts: [
2259
+ {
2260
+ name: "position";
2261
+ isMut: true;
2262
+ isSigner: false;
2263
+ },
2264
+ {
2265
+ name: "lbPair";
2266
+ isMut: true;
2267
+ isSigner: false;
2268
+ },
2269
+ {
2270
+ name: "binArrayBitmapExtension";
2271
+ isMut: true;
2272
+ isSigner: false;
2273
+ isOptional: true;
2274
+ },
2275
+ {
2276
+ name: "userToken";
2277
+ isMut: true;
2278
+ isSigner: false;
2279
+ },
2280
+ {
2281
+ name: "reserve";
2282
+ isMut: true;
2283
+ isSigner: false;
2284
+ },
2285
+ {
2286
+ name: "tokenMint";
2287
+ isMut: false;
2288
+ isSigner: false;
2289
+ },
2290
+ {
2291
+ name: "binArrayLower";
2292
+ isMut: true;
2293
+ isSigner: false;
2294
+ },
2295
+ {
2296
+ name: "binArrayUpper";
2297
+ isMut: true;
2298
+ isSigner: false;
2299
+ },
2300
+ {
2301
+ name: "sender";
2302
+ isMut: false;
2303
+ isSigner: true;
2304
+ },
2305
+ {
2306
+ name: "tokenProgram";
2307
+ isMut: false;
2308
+ isSigner: false;
2309
+ },
2310
+ {
2311
+ name: "eventAuthority";
2312
+ isMut: false;
2313
+ isSigner: false;
2314
+ },
2315
+ {
2316
+ name: "program";
2317
+ isMut: false;
2318
+ isSigner: false;
2319
+ }
2320
+ ];
2321
+ args: [
2322
+ {
2323
+ name: "parameter";
2324
+ type: {
2325
+ defined: "AddLiquiditySingleSidePreciseParameter";
2326
+ };
2327
+ }
2328
+ ];
2329
+ },
2330
+ {
2331
+ name: "goToABin";
2332
+ accounts: [
2333
+ {
2334
+ name: "lbPair";
2335
+ isMut: true;
2336
+ isSigner: false;
2337
+ },
2338
+ {
2339
+ name: "binArrayBitmapExtension";
2340
+ isMut: false;
2341
+ isSigner: false;
2342
+ isOptional: true;
2343
+ },
2344
+ {
2345
+ name: "fromBinArray";
2346
+ isMut: false;
2347
+ isSigner: false;
2348
+ isOptional: true;
2349
+ },
2350
+ {
2351
+ name: "toBinArray";
2352
+ isMut: false;
2353
+ isSigner: false;
2354
+ isOptional: true;
2355
+ },
2356
+ {
2357
+ name: "eventAuthority";
2358
+ isMut: false;
2359
+ isSigner: false;
2360
+ },
2361
+ {
2362
+ name: "program";
2363
+ isMut: false;
2364
+ isSigner: false;
2365
+ }
2366
+ ];
2367
+ args: [
2368
+ {
2369
+ name: "binId";
2370
+ type: "i32";
2371
+ }
2372
+ ];
2288
2373
  }
2289
2374
  ];
2290
2375
  accounts: [
@@ -2422,10 +2507,20 @@ type LbClmm = {
2422
2507
  docs: ["Status of the pair. Check PairStatus enum."];
2423
2508
  type: "u8";
2424
2509
  },
2510
+ {
2511
+ name: "requireBaseFactorSeed";
2512
+ type: "u8";
2513
+ },
2514
+ {
2515
+ name: "baseFactorSeed";
2516
+ type: {
2517
+ array: ["u8", 2];
2518
+ };
2519
+ },
2425
2520
  {
2426
2521
  name: "padding1";
2427
2522
  type: {
2428
- array: ["u8", 5];
2523
+ array: ["u8", 2];
2429
2524
  };
2430
2525
  },
2431
2526
  {
@@ -3037,6 +3132,42 @@ type LbClmm = {
3037
3132
  ];
3038
3133
  };
3039
3134
  },
3135
+ {
3136
+ name: "AddLiquiditySingleSidePreciseParameter";
3137
+ type: {
3138
+ kind: "struct";
3139
+ fields: [
3140
+ {
3141
+ name: "bins";
3142
+ type: {
3143
+ vec: {
3144
+ defined: "CompressedBinDepositAmount";
3145
+ };
3146
+ };
3147
+ },
3148
+ {
3149
+ name: "decompressMultiplier";
3150
+ type: "u64";
3151
+ }
3152
+ ];
3153
+ };
3154
+ },
3155
+ {
3156
+ name: "CompressedBinDepositAmount";
3157
+ type: {
3158
+ kind: "struct";
3159
+ fields: [
3160
+ {
3161
+ name: "binId";
3162
+ type: "i32";
3163
+ },
3164
+ {
3165
+ name: "amount";
3166
+ type: "u32";
3167
+ }
3168
+ ];
3169
+ };
3170
+ },
3040
3171
  {
3041
3172
  name: "BinLiquidityDistribution";
3042
3173
  type: {
@@ -4149,6 +4280,26 @@ type LbClmm = {
4149
4280
  index: false;
4150
4281
  }
4151
4282
  ];
4283
+ },
4284
+ {
4285
+ name: "GoToABin";
4286
+ fields: [
4287
+ {
4288
+ name: "lbPair";
4289
+ type: "publicKey";
4290
+ index: false;
4291
+ },
4292
+ {
4293
+ name: "fromBinId";
4294
+ type: "i32";
4295
+ index: false;
4296
+ },
4297
+ {
4298
+ name: "toBinId";
4299
+ type: "i32";
4300
+ index: false;
4301
+ }
4302
+ ];
4152
4303
  }
4153
4304
  ];
4154
4305
  errors: [
@@ -4441,6 +4592,11 @@ type LbClmm = {
4441
4592
  code: 6057;
4442
4593
  name: "InvalidLockReleaseSlot";
4443
4594
  msg: "Invalid lock release slot";
4595
+ },
4596
+ {
4597
+ code: 6058;
4598
+ name: "BinRangeIsNotEmpty";
4599
+ msg: "Bin range is not empty";
4444
4600
  }
4445
4601
  ];
4446
4602
  };
@@ -5106,9 +5262,19 @@ declare class DLMM {
5106
5262
  }
5107
5263
 
5108
5264
  /** private */
5265
+ /**
5266
+ *
5267
+ * @deprecated Use derivePresetParameter2
5268
+ */
5109
5269
  declare function derivePresetParameter(binStep: BN, programId: PublicKey): [PublicKey, number];
5270
+ declare function derivePresetParameter2(binStep: BN, baseFactor: BN, programId: PublicKey): [PublicKey, number];
5271
+ declare function deriveLbPair2(tokenX: PublicKey, tokenY: PublicKey, binStep: BN, baseFactor: BN, programId: PublicKey): [PublicKey, number];
5272
+ /**
5273
+ *
5274
+ * @deprecated Use deriveLbPair2
5275
+ */
5110
5276
  declare function deriveLbPair(tokenX: PublicKey, tokenY: PublicKey, binStep: BN, programId: PublicKey): [PublicKey, number];
5111
- declare function checkPoolExists(connection: Connection, tokenX: PublicKey, tokenY: PublicKey, binStep: BN, programId: PublicKey): Promise<PublicKey | false>;
5277
+ declare function checkPoolExists(connection: Connection, tokenX: PublicKey, tokenY: PublicKey, binStep: BN, baseFactor: BN, programId: PublicKey): Promise<PublicKey | false>;
5112
5278
  declare function derivePermissionLbPair(baseKey: PublicKey, tokenX: PublicKey, tokenY: PublicKey, binStep: BN, programId: PublicKey): [PublicKey, number];
5113
5279
  declare function deriveOracle(lbPair: PublicKey, programId: PublicKey): [PublicKey, number];
5114
5280
  declare function derivePosition(mint: PublicKey, programId: PublicKey): [PublicKey, number];
@@ -5393,6 +5559,8 @@ declare function chunkedFetchMultiplePoolAccount(program: ClmmProgram, pks: Publ
5393
5559
  activeId: number;
5394
5560
  binStep: number;
5395
5561
  status: number;
5562
+ requireBaseFactorSeed: number;
5563
+ baseFactorSeed: number[];
5396
5564
  padding1: number[];
5397
5565
  tokenXMint: PublicKey;
5398
5566
  tokenYMint: PublicKey;
@@ -5481,4 +5649,4 @@ declare const MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX = 26;
5481
5649
  declare const MAX_BIN_PER_TX = 69;
5482
5650
  declare const MAX_ACTIVE_BIN_SLIPPAGE = 3;
5483
5651
 
5484
- export { ADMIN, BASIS_POINT_MAX, BIN_ARRAY_BITMAP_SIZE, BIN_ARRAY_FEE, Bin, BinAndAmount, BinArray, BinArrayAccount, BinArrayBitmapExtension, BinArrayBitmapExtensionAccount, BinLiquidity, BinLiquidityDistribution, BinLiquidityReduction, BitmapType, ClmmProgram, DLMMError, EXTENSION_BINARRAY_BITMAP_SIZE, EmissionRate, FEE_PRECISION, FeeInfo, GetOrCreateATAResponse, IAccountsCache, IDL, InitPermissionPairIx, LBCLMM_PROGRAM_IDS, LMRewards, LbClmm, LbPair, LbPairAccount, LbPosition, LiquidityOneSideParameter, 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_FEE_RATE, Network, POSITION_FEE, PRECISION, PairType, Position, PositionBinData, PositionData, PositionInfo, PositionVersion, ProgramStrategyParameter, ProgramStrategyType, SCALE, SCALE_OFFSET, SIMULATION_USER, Strategy, StrategyParameters, StrategyType, SwapFee, SwapParams, SwapQuote, TInitializePositionAndAddLiquidityParams, TInitializePositionAndAddLiquidityParamsByStrategy, TQuoteCreatePositionParams, TokenReserve, autoFillXByStrategy, autoFillXByWeight, autoFillYByStrategy, autoFillYByWeight, binIdToBinArrayIndex, calculateBidAskDistribution, calculateNormalDistribution, calculateSpotDistribution, checkPoolExists, chunkedFetchMultipleBinArrayBitmapExtensionAccount, chunkedFetchMultiplePoolAccount, chunkedGetMultipleAccountInfos, chunks, computeBudgetIx, computeFee, computeFeeFromAmount, computeProtocolFee, DLMM as default, deriveBinArray, deriveBinArrayBitmapExtension, deriveLbPair, deriveOracle, derivePermissionLbPair, derivePosition, derivePresetParameter, deriveReserve, findNextBinArrayIndexWithLiquidity, findNextBinArrayWithLiquidity, fromWeightDistributionToAmount, fromWeightDistributionToAmountOneSide, getBaseFee, getBinArrayLowerUpperBinId, getBinFromBinArray, getOrCreateATAInstruction, getOutAmount, getPriceOfBinByBinId, getTokenBalance, getTokenDecimals, getTotalFee, getVariableFee, isBinIdWithinBinArray, isOverflowDefaultBinArrayBitmap, parseLogs, sParameters, swapQuoteAtBin, swapQuoteAtBinWithCap, toAmountAskSide, toAmountBidSide, toAmountBothSide, toAmountsBothSideByStrategy, toAmountsOneSideByStrategy, toStrategyParameters, toWeightDistribution, unwrapSOLInstruction, vParameters, wrapSOLInstruction };
5652
+ export { ADMIN, BASIS_POINT_MAX, BIN_ARRAY_BITMAP_SIZE, BIN_ARRAY_FEE, Bin, BinAndAmount, BinArray, BinArrayAccount, BinArrayBitmapExtension, BinArrayBitmapExtensionAccount, BinLiquidity, BinLiquidityDistribution, BinLiquidityReduction, BitmapType, ClmmProgram, DLMMError, EXTENSION_BINARRAY_BITMAP_SIZE, EmissionRate, FEE_PRECISION, FeeInfo, GetOrCreateATAResponse, IAccountsCache, IDL, InitPermissionPairIx, LBCLMM_PROGRAM_IDS, LMRewards, LbClmm, LbPair, LbPairAccount, LbPosition, LiquidityOneSideParameter, 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_FEE_RATE, Network, POSITION_FEE, PRECISION, PairType, Position, PositionBinData, PositionData, PositionInfo, PositionVersion, ProgramStrategyParameter, ProgramStrategyType, SCALE, SCALE_OFFSET, SIMULATION_USER, Strategy, StrategyParameters, StrategyType, SwapFee, SwapParams, SwapQuote, TInitializePositionAndAddLiquidityParams, TInitializePositionAndAddLiquidityParamsByStrategy, TQuoteCreatePositionParams, TokenReserve, autoFillXByStrategy, autoFillXByWeight, autoFillYByStrategy, autoFillYByWeight, binIdToBinArrayIndex, calculateBidAskDistribution, calculateNormalDistribution, calculateSpotDistribution, checkPoolExists, chunkedFetchMultipleBinArrayBitmapExtensionAccount, chunkedFetchMultiplePoolAccount, chunkedGetMultipleAccountInfos, chunks, computeBudgetIx, computeFee, computeFeeFromAmount, computeProtocolFee, DLMM as default, deriveBinArray, deriveBinArrayBitmapExtension, deriveLbPair, deriveLbPair2, deriveOracle, derivePermissionLbPair, derivePosition, derivePresetParameter, derivePresetParameter2, deriveReserve, findNextBinArrayIndexWithLiquidity, findNextBinArrayWithLiquidity, fromWeightDistributionToAmount, fromWeightDistributionToAmountOneSide, getBaseFee, getBinArrayLowerUpperBinId, getBinFromBinArray, getOrCreateATAInstruction, getOutAmount, getPriceOfBinByBinId, getTokenBalance, getTokenDecimals, getTotalFee, getVariableFee, isBinIdWithinBinArray, isOverflowDefaultBinArrayBitmap, parseLogs, sParameters, swapQuoteAtBin, swapQuoteAtBinWithCap, toAmountAskSide, toAmountBidSide, toAmountBothSide, toAmountsBothSideByStrategy, toAmountsOneSideByStrategy, toStrategyParameters, toWeightDistribution, unwrapSOLInstruction, vParameters, wrapSOLInstruction };
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ var _web3js = require('@solana/web3.js');
9
9
 
10
10
  // src/dlmm/idl.ts
11
11
  var IDL = {
12
- version: "0.5.0",
12
+ version: "0.5.1",
13
13
  name: "lb_clmm",
14
14
  constants: [
15
15
  {
@@ -1772,39 +1772,6 @@ var IDL = {
1772
1772
  }
1773
1773
  ]
1774
1774
  },
1775
- {
1776
- name: "initializePresetParameterV2",
1777
- accounts: [
1778
- {
1779
- name: "presetParameter",
1780
- isMut: true,
1781
- isSigner: false
1782
- },
1783
- {
1784
- name: "admin",
1785
- isMut: true,
1786
- isSigner: true
1787
- },
1788
- {
1789
- name: "systemProgram",
1790
- isMut: false,
1791
- isSigner: false
1792
- },
1793
- {
1794
- name: "rent",
1795
- isMut: false,
1796
- isSigner: false
1797
- }
1798
- ],
1799
- args: [
1800
- {
1801
- name: "ix",
1802
- type: {
1803
- defined: "InitPresetParametersIx"
1804
- }
1805
- }
1806
- ]
1807
- },
1808
1775
  {
1809
1776
  name: "closePresetParameter",
1810
1777
  accounts: [
@@ -2289,6 +2256,124 @@ var IDL = {
2289
2256
  type: "u16"
2290
2257
  }
2291
2258
  ]
2259
+ },
2260
+ {
2261
+ name: "addLiquidityOneSidePrecise",
2262
+ accounts: [
2263
+ {
2264
+ name: "position",
2265
+ isMut: true,
2266
+ isSigner: false
2267
+ },
2268
+ {
2269
+ name: "lbPair",
2270
+ isMut: true,
2271
+ isSigner: false
2272
+ },
2273
+ {
2274
+ name: "binArrayBitmapExtension",
2275
+ isMut: true,
2276
+ isSigner: false,
2277
+ isOptional: true
2278
+ },
2279
+ {
2280
+ name: "userToken",
2281
+ isMut: true,
2282
+ isSigner: false
2283
+ },
2284
+ {
2285
+ name: "reserve",
2286
+ isMut: true,
2287
+ isSigner: false
2288
+ },
2289
+ {
2290
+ name: "tokenMint",
2291
+ isMut: false,
2292
+ isSigner: false
2293
+ },
2294
+ {
2295
+ name: "binArrayLower",
2296
+ isMut: true,
2297
+ isSigner: false
2298
+ },
2299
+ {
2300
+ name: "binArrayUpper",
2301
+ isMut: true,
2302
+ isSigner: false
2303
+ },
2304
+ {
2305
+ name: "sender",
2306
+ isMut: false,
2307
+ isSigner: true
2308
+ },
2309
+ {
2310
+ name: "tokenProgram",
2311
+ isMut: false,
2312
+ isSigner: false
2313
+ },
2314
+ {
2315
+ name: "eventAuthority",
2316
+ isMut: false,
2317
+ isSigner: false
2318
+ },
2319
+ {
2320
+ name: "program",
2321
+ isMut: false,
2322
+ isSigner: false
2323
+ }
2324
+ ],
2325
+ args: [
2326
+ {
2327
+ name: "parameter",
2328
+ type: {
2329
+ defined: "AddLiquiditySingleSidePreciseParameter"
2330
+ }
2331
+ }
2332
+ ]
2333
+ },
2334
+ {
2335
+ name: "goToABin",
2336
+ accounts: [
2337
+ {
2338
+ name: "lbPair",
2339
+ isMut: true,
2340
+ isSigner: false
2341
+ },
2342
+ {
2343
+ name: "binArrayBitmapExtension",
2344
+ isMut: false,
2345
+ isSigner: false,
2346
+ isOptional: true
2347
+ },
2348
+ {
2349
+ name: "fromBinArray",
2350
+ isMut: false,
2351
+ isSigner: false,
2352
+ isOptional: true
2353
+ },
2354
+ {
2355
+ name: "toBinArray",
2356
+ isMut: false,
2357
+ isSigner: false,
2358
+ isOptional: true
2359
+ },
2360
+ {
2361
+ name: "eventAuthority",
2362
+ isMut: false,
2363
+ isSigner: false
2364
+ },
2365
+ {
2366
+ name: "program",
2367
+ isMut: false,
2368
+ isSigner: false
2369
+ }
2370
+ ],
2371
+ args: [
2372
+ {
2373
+ name: "binId",
2374
+ type: "i32"
2375
+ }
2376
+ ]
2292
2377
  }
2293
2378
  ],
2294
2379
  accounts: [
@@ -2426,10 +2511,20 @@ var IDL = {
2426
2511
  docs: ["Status of the pair. Check PairStatus enum."],
2427
2512
  type: "u8"
2428
2513
  },
2514
+ {
2515
+ name: "requireBaseFactorSeed",
2516
+ type: "u8"
2517
+ },
2518
+ {
2519
+ name: "baseFactorSeed",
2520
+ type: {
2521
+ array: ["u8", 2]
2522
+ }
2523
+ },
2429
2524
  {
2430
2525
  name: "padding1",
2431
2526
  type: {
2432
- array: ["u8", 5]
2527
+ array: ["u8", 2]
2433
2528
  }
2434
2529
  },
2435
2530
  {
@@ -3041,6 +3136,42 @@ var IDL = {
3041
3136
  ]
3042
3137
  }
3043
3138
  },
3139
+ {
3140
+ name: "AddLiquiditySingleSidePreciseParameter",
3141
+ type: {
3142
+ kind: "struct",
3143
+ fields: [
3144
+ {
3145
+ name: "bins",
3146
+ type: {
3147
+ vec: {
3148
+ defined: "CompressedBinDepositAmount"
3149
+ }
3150
+ }
3151
+ },
3152
+ {
3153
+ name: "decompressMultiplier",
3154
+ type: "u64"
3155
+ }
3156
+ ]
3157
+ }
3158
+ },
3159
+ {
3160
+ name: "CompressedBinDepositAmount",
3161
+ type: {
3162
+ kind: "struct",
3163
+ fields: [
3164
+ {
3165
+ name: "binId",
3166
+ type: "i32"
3167
+ },
3168
+ {
3169
+ name: "amount",
3170
+ type: "u32"
3171
+ }
3172
+ ]
3173
+ }
3174
+ },
3044
3175
  {
3045
3176
  name: "BinLiquidityDistribution",
3046
3177
  type: {
@@ -4153,6 +4284,26 @@ var IDL = {
4153
4284
  index: false
4154
4285
  }
4155
4286
  ]
4287
+ },
4288
+ {
4289
+ name: "GoToABin",
4290
+ fields: [
4291
+ {
4292
+ name: "lbPair",
4293
+ type: "publicKey",
4294
+ index: false
4295
+ },
4296
+ {
4297
+ name: "fromBinId",
4298
+ type: "i32",
4299
+ index: false
4300
+ },
4301
+ {
4302
+ name: "toBinId",
4303
+ type: "i32",
4304
+ index: false
4305
+ }
4306
+ ]
4156
4307
  }
4157
4308
  ],
4158
4309
  errors: [
@@ -4445,6 +4596,11 @@ var IDL = {
4445
4596
  code: 6057,
4446
4597
  name: "InvalidLockReleaseSlot",
4447
4598
  msg: "Invalid lock release slot"
4599
+ },
4600
+ {
4601
+ code: 6058,
4602
+ name: "BinRangeIsNotEmpty",
4603
+ msg: "Bin range is not empty"
4448
4604
  }
4449
4605
  ]
4450
4606
  };
@@ -4749,6 +4905,28 @@ function derivePresetParameter(binStep, programId) {
4749
4905
  programId
4750
4906
  );
4751
4907
  }
4908
+ function derivePresetParameter2(binStep, baseFactor, programId) {
4909
+ return _web3js.PublicKey.findProgramAddressSync(
4910
+ [
4911
+ Buffer.from("preset_parameter"),
4912
+ new Uint8Array(binStep.toArrayLike(Buffer, "le", 2)),
4913
+ new Uint8Array(baseFactor.toArrayLike(Buffer, "le", 2))
4914
+ ],
4915
+ programId
4916
+ );
4917
+ }
4918
+ function deriveLbPair2(tokenX, tokenY, binStep, baseFactor, programId) {
4919
+ const [minKey, maxKey] = sortTokenMints(tokenX, tokenY);
4920
+ return _web3js.PublicKey.findProgramAddressSync(
4921
+ [
4922
+ minKey.toBuffer(),
4923
+ maxKey.toBuffer(),
4924
+ new Uint8Array(binStep.toArrayLike(Buffer, "le", 2)),
4925
+ new Uint8Array(baseFactor.toArrayLike(Buffer, "le", 2))
4926
+ ],
4927
+ programId
4928
+ );
4929
+ }
4752
4930
  function deriveLbPair(tokenX, tokenY, binStep, programId) {
4753
4931
  const [minKey, maxKey] = sortTokenMints(tokenX, tokenY);
4754
4932
  return _web3js.PublicKey.findProgramAddressSync(
@@ -4760,9 +4938,15 @@ function deriveLbPair(tokenX, tokenY, binStep, programId) {
4760
4938
  programId
4761
4939
  );
4762
4940
  }
4763
- async function checkPoolExists(connection, tokenX, tokenY, binStep, programId) {
4941
+ async function checkPoolExists(connection, tokenX, tokenY, binStep, baseFactor, programId) {
4764
4942
  try {
4765
- const [lbPairKey] = deriveLbPair(tokenX, tokenY, binStep, programId);
4943
+ const [lbPairKey] = deriveLbPair2(
4944
+ tokenX,
4945
+ tokenY,
4946
+ binStep,
4947
+ baseFactor,
4948
+ programId
4949
+ );
4766
4950
  await DLMM.create(connection, lbPairKey);
4767
4951
  return lbPairKey;
4768
4952
  } catch (e2) {
@@ -4772,7 +4956,12 @@ async function checkPoolExists(connection, tokenX, tokenY, binStep, programId) {
4772
4956
  function derivePermissionLbPair(baseKey, tokenX, tokenY, binStep, programId) {
4773
4957
  const [minKey, maxKey] = sortTokenMints(tokenX, tokenY);
4774
4958
  return _web3js.PublicKey.findProgramAddressSync(
4775
- [baseKey.toBuffer(), minKey.toBuffer(), maxKey.toBuffer(), new Uint8Array(binStep.toArrayLike(Buffer, "le", 2))],
4959
+ [
4960
+ baseKey.toBuffer(),
4961
+ minKey.toBuffer(),
4962
+ maxKey.toBuffer(),
4963
+ new Uint8Array(binStep.toArrayLike(Buffer, "le", 2))
4964
+ ],
4776
4965
  programId
4777
4966
  );
4778
4967
  }
@@ -7033,7 +7222,13 @@ var DLMM = class {
7033
7222
  presetParameter
7034
7223
  );
7035
7224
  const binStep = new (0, _anchor.BN)(presetParameterState.binStep);
7036
- const [lbPair] = deriveLbPair(tokenX, tokenY, binStep, program.programId);
7225
+ const [lbPair] = deriveLbPair2(
7226
+ tokenX,
7227
+ tokenY,
7228
+ binStep,
7229
+ new (0, _anchor.BN)(presetParameterState.baseFactor),
7230
+ program.programId
7231
+ );
7037
7232
  const [reserveX] = deriveReserve(tokenX, lbPair, program.programId);
7038
7233
  const [reserveY] = deriveReserve(tokenY, lbPair, program.programId);
7039
7234
  const [oracle] = deriveOracle(lbPair, program.programId);
@@ -9844,5 +10039,7 @@ var src_default = DLMM;
9844
10039
 
9845
10040
 
9846
10041
 
9847
- exports.ADMIN = ADMIN; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.BIN_ARRAY_BITMAP_SIZE = BIN_ARRAY_BITMAP_SIZE; exports.BIN_ARRAY_FEE = BIN_ARRAY_FEE; exports.BitmapType = BitmapType; exports.DLMMError = DLMMError; exports.EXTENSION_BINARRAY_BITMAP_SIZE = EXTENSION_BINARRAY_BITMAP_SIZE; exports.FEE_PRECISION = FEE_PRECISION; exports.IDL = IDL; 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_FEE_RATE = MAX_FEE_RATE; exports.Network = Network; exports.POSITION_FEE = POSITION_FEE; exports.PRECISION = PRECISION; 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.autoFillXByStrategy = autoFillXByStrategy; exports.autoFillXByWeight = autoFillXByWeight; exports.autoFillYByStrategy = autoFillYByStrategy; exports.autoFillYByWeight = autoFillYByWeight; exports.binIdToBinArrayIndex = binIdToBinArrayIndex; exports.calculateBidAskDistribution = calculateBidAskDistribution; exports.calculateNormalDistribution = calculateNormalDistribution; exports.calculateSpotDistribution = calculateSpotDistribution; exports.checkPoolExists = checkPoolExists; exports.chunkedFetchMultipleBinArrayBitmapExtensionAccount = chunkedFetchMultipleBinArrayBitmapExtensionAccount; exports.chunkedFetchMultiplePoolAccount = chunkedFetchMultiplePoolAccount; exports.chunkedGetMultipleAccountInfos = chunkedGetMultipleAccountInfos; exports.chunks = chunks; exports.computeBudgetIx = computeBudgetIx; exports.computeFee = computeFee; exports.computeFeeFromAmount = computeFeeFromAmount; exports.computeProtocolFee = computeProtocolFee; exports.default = src_default; exports.deriveBinArray = deriveBinArray; exports.deriveBinArrayBitmapExtension = deriveBinArrayBitmapExtension; exports.deriveLbPair = deriveLbPair; exports.deriveOracle = deriveOracle; exports.derivePermissionLbPair = derivePermissionLbPair; exports.derivePosition = derivePosition; exports.derivePresetParameter = derivePresetParameter; exports.deriveReserve = deriveReserve; exports.findNextBinArrayIndexWithLiquidity = findNextBinArrayIndexWithLiquidity; exports.findNextBinArrayWithLiquidity = findNextBinArrayWithLiquidity; exports.fromWeightDistributionToAmount = fromWeightDistributionToAmount; exports.fromWeightDistributionToAmountOneSide = fromWeightDistributionToAmountOneSide; exports.getBaseFee = getBaseFee; exports.getBinArrayLowerUpperBinId = getBinArrayLowerUpperBinId; exports.getBinFromBinArray = getBinFromBinArray; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getOutAmount = getOutAmount; exports.getPriceOfBinByBinId = getPriceOfBinByBinId; exports.getTokenBalance = getTokenBalance; exports.getTokenDecimals = getTokenDecimals; exports.getTotalFee = getTotalFee; exports.getVariableFee = getVariableFee; exports.isBinIdWithinBinArray = isBinIdWithinBinArray; exports.isOverflowDefaultBinArrayBitmap = isOverflowDefaultBinArrayBitmap; exports.parseLogs = parseLogs; exports.swapQuoteAtBin = swapQuoteAtBin; exports.swapQuoteAtBinWithCap = swapQuoteAtBinWithCap; exports.toAmountAskSide = toAmountAskSide; exports.toAmountBidSide = toAmountBidSide; exports.toAmountBothSide = toAmountBothSide; exports.toAmountsBothSideByStrategy = toAmountsBothSideByStrategy; exports.toAmountsOneSideByStrategy = toAmountsOneSideByStrategy; exports.toStrategyParameters = toStrategyParameters; exports.toWeightDistribution = toWeightDistribution; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.wrapSOLInstruction = wrapSOLInstruction;
10042
+
10043
+
10044
+ exports.ADMIN = ADMIN; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.BIN_ARRAY_BITMAP_SIZE = BIN_ARRAY_BITMAP_SIZE; exports.BIN_ARRAY_FEE = BIN_ARRAY_FEE; exports.BitmapType = BitmapType; exports.DLMMError = DLMMError; exports.EXTENSION_BINARRAY_BITMAP_SIZE = EXTENSION_BINARRAY_BITMAP_SIZE; exports.FEE_PRECISION = FEE_PRECISION; exports.IDL = IDL; 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_FEE_RATE = MAX_FEE_RATE; exports.Network = Network; exports.POSITION_FEE = POSITION_FEE; exports.PRECISION = PRECISION; 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.autoFillXByStrategy = autoFillXByStrategy; exports.autoFillXByWeight = autoFillXByWeight; exports.autoFillYByStrategy = autoFillYByStrategy; exports.autoFillYByWeight = autoFillYByWeight; exports.binIdToBinArrayIndex = binIdToBinArrayIndex; exports.calculateBidAskDistribution = calculateBidAskDistribution; exports.calculateNormalDistribution = calculateNormalDistribution; exports.calculateSpotDistribution = calculateSpotDistribution; exports.checkPoolExists = checkPoolExists; exports.chunkedFetchMultipleBinArrayBitmapExtensionAccount = chunkedFetchMultipleBinArrayBitmapExtensionAccount; exports.chunkedFetchMultiplePoolAccount = chunkedFetchMultiplePoolAccount; exports.chunkedGetMultipleAccountInfos = chunkedGetMultipleAccountInfos; exports.chunks = chunks; exports.computeBudgetIx = computeBudgetIx; exports.computeFee = computeFee; exports.computeFeeFromAmount = computeFeeFromAmount; exports.computeProtocolFee = computeProtocolFee; exports.default = src_default; exports.deriveBinArray = deriveBinArray; exports.deriveBinArrayBitmapExtension = deriveBinArrayBitmapExtension; exports.deriveLbPair = deriveLbPair; exports.deriveLbPair2 = deriveLbPair2; exports.deriveOracle = deriveOracle; exports.derivePermissionLbPair = derivePermissionLbPair; exports.derivePosition = derivePosition; exports.derivePresetParameter = derivePresetParameter; exports.derivePresetParameter2 = derivePresetParameter2; exports.deriveReserve = deriveReserve; exports.findNextBinArrayIndexWithLiquidity = findNextBinArrayIndexWithLiquidity; exports.findNextBinArrayWithLiquidity = findNextBinArrayWithLiquidity; exports.fromWeightDistributionToAmount = fromWeightDistributionToAmount; exports.fromWeightDistributionToAmountOneSide = fromWeightDistributionToAmountOneSide; exports.getBaseFee = getBaseFee; exports.getBinArrayLowerUpperBinId = getBinArrayLowerUpperBinId; exports.getBinFromBinArray = getBinFromBinArray; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getOutAmount = getOutAmount; exports.getPriceOfBinByBinId = getPriceOfBinByBinId; exports.getTokenBalance = getTokenBalance; exports.getTokenDecimals = getTokenDecimals; exports.getTotalFee = getTotalFee; exports.getVariableFee = getVariableFee; exports.isBinIdWithinBinArray = isBinIdWithinBinArray; exports.isOverflowDefaultBinArrayBitmap = isOverflowDefaultBinArrayBitmap; exports.parseLogs = parseLogs; exports.swapQuoteAtBin = swapQuoteAtBin; exports.swapQuoteAtBinWithCap = swapQuoteAtBinWithCap; exports.toAmountAskSide = toAmountAskSide; exports.toAmountBidSide = toAmountBidSide; exports.toAmountBothSide = toAmountBothSide; exports.toAmountsBothSideByStrategy = toAmountsBothSideByStrategy; exports.toAmountsOneSideByStrategy = toAmountsOneSideByStrategy; exports.toStrategyParameters = toStrategyParameters; exports.toWeightDistribution = toWeightDistribution; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.wrapSOLInstruction = wrapSOLInstruction;
9848
10045
  //# sourceMappingURL=index.js.map