@meteora-ag/dlmm 1.0.3 → 1.0.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
@@ -2082,6 +2082,27 @@ type LbClmm = {
2082
2082
  "type": "u64";
2083
2083
  }
2084
2084
  ];
2085
+ },
2086
+ {
2087
+ "name": "setActivationSlot";
2088
+ "accounts": [
2089
+ {
2090
+ "name": "lbPair";
2091
+ "isMut": true;
2092
+ "isSigner": false;
2093
+ },
2094
+ {
2095
+ "name": "admin";
2096
+ "isMut": true;
2097
+ "isSigner": true;
2098
+ }
2099
+ ];
2100
+ "args": [
2101
+ {
2102
+ "name": "activationSlot";
2103
+ "type": "u64";
2104
+ }
2105
+ ];
2085
2106
  }
2086
2107
  ];
2087
2108
  "accounts": [
@@ -2242,7 +2263,7 @@ type LbClmm = {
2242
2263
  {
2243
2264
  "name": "status";
2244
2265
  "docs": [
2245
- "Status of the pair"
2266
+ "Status of the pair. Check PairStatus enum."
2246
2267
  ];
2247
2268
  "type": "u8";
2248
2269
  },
@@ -2358,6 +2379,13 @@ type LbClmm = {
2358
2379
  ];
2359
2380
  "type": "publicKey";
2360
2381
  },
2382
+ {
2383
+ "name": "activationSlot";
2384
+ "docs": [
2385
+ "Slot to enable the pair. Only available for permission pair."
2386
+ ];
2387
+ "type": "u64";
2388
+ },
2361
2389
  {
2362
2390
  "name": "reserved";
2363
2391
  "docs": [
@@ -2366,7 +2394,7 @@ type LbClmm = {
2366
2394
  "type": {
2367
2395
  "array": [
2368
2396
  "u8",
2369
- 88
2397
+ 80
2370
2398
  ];
2371
2399
  };
2372
2400
  }
@@ -4390,6 +4418,7 @@ type LbClmm = {
4390
4418
  }
4391
4419
  ];
4392
4420
  };
4421
+ declare const IDL: LbClmm;
4393
4422
 
4394
4423
  interface BinAndAmount {
4395
4424
  binId: number;
@@ -5081,6 +5110,7 @@ declare function chunkedFetchMultiplePoolAccount(program: ClmmProgram, pks: Publ
5081
5110
  lastUpdatedAt: BN;
5082
5111
  whitelistedWallet: PublicKey[];
5083
5112
  baseKey: PublicKey;
5113
+ activationSlot: BN;
5084
5114
  reserved: number[];
5085
5115
  }[]>;
5086
5116
  declare function chunkedFetchMultipleBinArrayBitmapExtensionAccount(program: ClmmProgram, pks: PublicKey[], chunkSize?: number): Promise<{
@@ -5098,6 +5128,14 @@ declare const unwrapSOLInstruction: (owner: PublicKey) => Promise<TransactionIns
5098
5128
  declare function chunkedGetMultipleAccountInfos(connection: Connection, pks: PublicKey[], chunkSize?: number): Promise<_solana_web3_js.AccountInfo<Buffer>[]>;
5099
5129
  declare const computeBudgetIx: () => TransactionInstruction;
5100
5130
 
5131
+ type Codes = (typeof IDL.errors)[number]["code"];
5132
+ declare class DLMMError extends Error {
5133
+ errorCode: number;
5134
+ errorName: string;
5135
+ errorMessage: string;
5136
+ constructor(error: object | Codes);
5137
+ }
5138
+
5101
5139
  declare const LBCLMM_PROGRAM_IDS: {
5102
5140
  devnet: string;
5103
5141
  localhost: string;
@@ -5128,4 +5166,4 @@ declare const MAX_CLAIM_ALL_ALLOWED = 3;
5128
5166
  declare const MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX = 26;
5129
5167
  declare const MAX_ACTIVE_BIN_SLIPPAGE = 3;
5130
5168
 
5131
- export { ADMIN, BASIS_POINT_MAX, BIN_ARRAY_BITMAP_SIZE, Bin, BinAndAmount, BinArray, BinArrayAccount, BinArrayBitmapExtension, BinArrayBitmapExtensionAccount, BinLiquidity, BinLiquidityDistribution, BinLiquidityReduction, BitmapType, ClmmProgram, EXTENSION_BINARRAY_BITMAP_SIZE, EmissionRate, FEE_PRECISION, FeeInfo, GetOrCreateATAResponse, IAccountsCache, LBCLMM_PROGRAM_IDS, LMRewards, LbPairAccount, LbPairAccountsStruct, LiquidityOneSideParameter, LiquidityParameterByWeight, MAX_ACTIVE_BIN_SLIPPAGE, MAX_BIN_ARRAY_SIZE, MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX, MAX_BIN_PER_POSITION, MAX_CLAIM_ALL_ALLOWED, MAX_FEE_RATE, Network, PRECISION, ParabolicParameter, Position, PositionAccount, PositionBinData, PositionData, PositionInfo, PositionVersion, SCALE, SCALE_OFFSET, SIMULATION_USER, SpotParameter, StrategyParameters, StrategyType, SwapFee, SwapParams, SwapQuote, TInitializePositionAndAddLiquidityParams, TokenReserve, binIdToBinArrayIndex, calculateBidAskDistribution, calculateNormalDistribution, calculateSpotDistribution, chunkedFetchMultipleBinArrayBitmapExtensionAccount, chunkedFetchMultiplePoolAccount, chunkedGetMultipleAccountInfos, chunks, computeBudgetIx, computeFee, computeFeeFromAmount, computeProtocolFee, DLMM as default, deriveBinArray, deriveBinArrayBitmapExtension, deriveLbPair, deriveOracle, derivePosition, derivePresetParameter, deriveReserve, findNextBinArrayIndexWithLiquidity, findNextBinArrayWithLiquidity, fromStrategyParamstoWeightDistribution, getBaseFee, getBinArrayLowerUpperBinId, getBinFromBinArray, getOrCreateATAInstruction, getOutAmount, getPriceOfBinByBinId, getTokenBalance, getTokenDecimals, getTotalFee, getVariableFee, isBinIdWithinBinArray, isOverflowDefaultBinArrayBitmap, parabolicParameter, parseLogs, sParameters, spotParameter, swapQuoteAtBin, toStrategyParameters, toWeightDistribution, unwrapSOLInstruction, vParameters, wrapSOLInstruction };
5169
+ export { ADMIN, BASIS_POINT_MAX, BIN_ARRAY_BITMAP_SIZE, Bin, BinAndAmount, BinArray, BinArrayAccount, BinArrayBitmapExtension, BinArrayBitmapExtensionAccount, BinLiquidity, BinLiquidityDistribution, BinLiquidityReduction, BitmapType, ClmmProgram, DLMMError, EXTENSION_BINARRAY_BITMAP_SIZE, EmissionRate, FEE_PRECISION, FeeInfo, GetOrCreateATAResponse, IAccountsCache, LBCLMM_PROGRAM_IDS, LMRewards, LbPairAccount, LbPairAccountsStruct, LiquidityOneSideParameter, LiquidityParameterByWeight, MAX_ACTIVE_BIN_SLIPPAGE, MAX_BIN_ARRAY_SIZE, MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX, MAX_BIN_PER_POSITION, MAX_CLAIM_ALL_ALLOWED, MAX_FEE_RATE, Network, PRECISION, ParabolicParameter, Position, PositionAccount, PositionBinData, PositionData, PositionInfo, PositionVersion, SCALE, SCALE_OFFSET, SIMULATION_USER, SpotParameter, StrategyParameters, StrategyType, SwapFee, SwapParams, SwapQuote, TInitializePositionAndAddLiquidityParams, TokenReserve, binIdToBinArrayIndex, calculateBidAskDistribution, calculateNormalDistribution, calculateSpotDistribution, chunkedFetchMultipleBinArrayBitmapExtensionAccount, chunkedFetchMultiplePoolAccount, chunkedGetMultipleAccountInfos, chunks, computeBudgetIx, computeFee, computeFeeFromAmount, computeProtocolFee, DLMM as default, deriveBinArray, deriveBinArrayBitmapExtension, deriveLbPair, deriveOracle, derivePosition, derivePresetParameter, deriveReserve, findNextBinArrayIndexWithLiquidity, findNextBinArrayWithLiquidity, fromStrategyParamstoWeightDistribution, getBaseFee, getBinArrayLowerUpperBinId, getBinFromBinArray, getOrCreateATAInstruction, getOutAmount, getPriceOfBinByBinId, getTokenBalance, getTokenDecimals, getTotalFee, getVariableFee, isBinIdWithinBinArray, isOverflowDefaultBinArrayBitmap, parabolicParameter, parseLogs, sParameters, spotParameter, swapQuoteAtBin, toStrategyParameters, toWeightDistribution, unwrapSOLInstruction, vParameters, wrapSOLInstruction };
package/dist/index.js CHANGED
@@ -2086,6 +2086,27 @@ var IDL = {
2086
2086
  "type": "u64"
2087
2087
  }
2088
2088
  ]
2089
+ },
2090
+ {
2091
+ "name": "setActivationSlot",
2092
+ "accounts": [
2093
+ {
2094
+ "name": "lbPair",
2095
+ "isMut": true,
2096
+ "isSigner": false
2097
+ },
2098
+ {
2099
+ "name": "admin",
2100
+ "isMut": true,
2101
+ "isSigner": true
2102
+ }
2103
+ ],
2104
+ "args": [
2105
+ {
2106
+ "name": "activationSlot",
2107
+ "type": "u64"
2108
+ }
2109
+ ]
2089
2110
  }
2090
2111
  ],
2091
2112
  "accounts": [
@@ -2246,7 +2267,7 @@ var IDL = {
2246
2267
  {
2247
2268
  "name": "status",
2248
2269
  "docs": [
2249
- "Status of the pair"
2270
+ "Status of the pair. Check PairStatus enum."
2250
2271
  ],
2251
2272
  "type": "u8"
2252
2273
  },
@@ -2362,6 +2383,13 @@ var IDL = {
2362
2383
  ],
2363
2384
  "type": "publicKey"
2364
2385
  },
2386
+ {
2387
+ "name": "activationSlot",
2388
+ "docs": [
2389
+ "Slot to enable the pair. Only available for permission pair."
2390
+ ],
2391
+ "type": "u64"
2392
+ },
2365
2393
  {
2366
2394
  "name": "reserved",
2367
2395
  "docs": [
@@ -2370,7 +2398,7 @@ var IDL = {
2370
2398
  "type": {
2371
2399
  "array": [
2372
2400
  "u8",
2373
- 88
2401
+ 80
2374
2402
  ]
2375
2403
  }
2376
2404
  }
@@ -7427,7 +7455,7 @@ var DLMM = class {
7427
7455
  pubkey
7428
7456
  };
7429
7457
  });
7430
- return await this.program.methods.swap(inAmount, minOutAmount).accounts({
7458
+ const swapTx = await this.program.methods.swap(inAmount, minOutAmount).accounts({
7431
7459
  lbPair,
7432
7460
  reserveX,
7433
7461
  reserveY,
@@ -7444,6 +7472,12 @@ var DLMM = class {
7444
7472
  oracle,
7445
7473
  hostFeeIn: null
7446
7474
  }).remainingAccounts(binArrays).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
7475
+ const { blockhash, lastValidBlockHeight } = await this.program.provider.connection.getLatestBlockhash("confirmed");
7476
+ return new (0, _web3js.Transaction)({
7477
+ blockhash,
7478
+ lastValidBlockHeight,
7479
+ feePayer: user
7480
+ }).add(swapTx);
7447
7481
  }
7448
7482
  /**
7449
7483
  * The claimLMReward function is used to claim rewards for a specific position owned by a specific owner.
@@ -8160,6 +8194,37 @@ var DLMM = class {
8160
8194
 
8161
8195
  // src/dlmm/error.ts
8162
8196
 
8197
+ var DLMMError = class extends Error {
8198
+
8199
+
8200
+
8201
+ constructor(error) {
8202
+ let _errorCode = 0;
8203
+ let _errorName = "Something went wrong";
8204
+ let _errorMessage = "Something went wrong";
8205
+ if (error instanceof Error) {
8206
+ const anchorError = _anchor.AnchorError.parse(
8207
+ JSON.parse(JSON.stringify(error)).logs
8208
+ );
8209
+ if (_optionalChain([anchorError, 'optionalAccess', _55 => _55.program, 'access', _56 => _56.toBase58, 'call', _57 => _57()]) === LBCLMM_PROGRAM_IDS["mainnet-beta"]) {
8210
+ _errorCode = anchorError.error.errorCode.number;
8211
+ _errorName = anchorError.error.errorCode.code;
8212
+ _errorMessage = anchorError.error.errorMessage;
8213
+ }
8214
+ } else {
8215
+ const idlError = IDL.errors.find((err) => err.code === error);
8216
+ if (idlError) {
8217
+ _errorCode = idlError.code;
8218
+ _errorName = idlError.name;
8219
+ _errorMessage = idlError.msg;
8220
+ }
8221
+ }
8222
+ super(_errorMessage);
8223
+ this.errorCode = _errorCode;
8224
+ this.errorName = _errorName;
8225
+ this.errorMessage = _errorMessage;
8226
+ }
8227
+ };
8163
8228
 
8164
8229
  // src/index.ts
8165
8230
  var src_default = DLMM;
@@ -8227,5 +8292,6 @@ var src_default = DLMM;
8227
8292
 
8228
8293
 
8229
8294
 
8230
- exports.ADMIN = ADMIN; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.BIN_ARRAY_BITMAP_SIZE = BIN_ARRAY_BITMAP_SIZE; exports.BitmapType = BitmapType; exports.EXTENSION_BINARRAY_BITMAP_SIZE = EXTENSION_BINARRAY_BITMAP_SIZE; exports.FEE_PRECISION = FEE_PRECISION; 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_CLAIM_ALL_ALLOWED = MAX_CLAIM_ALL_ALLOWED; exports.MAX_FEE_RATE = MAX_FEE_RATE; exports.Network = Network; exports.PRECISION = PRECISION; exports.PositionVersion = PositionVersion; exports.SCALE = SCALE; exports.SCALE_OFFSET = SCALE_OFFSET; exports.SIMULATION_USER = SIMULATION_USER; exports.StrategyType = StrategyType; 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.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.derivePosition = derivePosition; exports.derivePresetParameter = derivePresetParameter; exports.deriveReserve = deriveReserve; exports.findNextBinArrayIndexWithLiquidity = findNextBinArrayIndexWithLiquidity; exports.findNextBinArrayWithLiquidity = findNextBinArrayWithLiquidity; exports.fromStrategyParamstoWeightDistribution = fromStrategyParamstoWeightDistribution; 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.parabolicParameter = parabolicParameter; exports.parseLogs = parseLogs; exports.spotParameter = spotParameter; exports.swapQuoteAtBin = swapQuoteAtBin; exports.toStrategyParameters = toStrategyParameters; exports.toWeightDistribution = toWeightDistribution; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.wrapSOLInstruction = wrapSOLInstruction;
8295
+
8296
+ exports.ADMIN = ADMIN; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.BIN_ARRAY_BITMAP_SIZE = BIN_ARRAY_BITMAP_SIZE; exports.BitmapType = BitmapType; exports.DLMMError = DLMMError; exports.EXTENSION_BINARRAY_BITMAP_SIZE = EXTENSION_BINARRAY_BITMAP_SIZE; exports.FEE_PRECISION = FEE_PRECISION; 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_CLAIM_ALL_ALLOWED = MAX_CLAIM_ALL_ALLOWED; exports.MAX_FEE_RATE = MAX_FEE_RATE; exports.Network = Network; exports.PRECISION = PRECISION; exports.PositionVersion = PositionVersion; exports.SCALE = SCALE; exports.SCALE_OFFSET = SCALE_OFFSET; exports.SIMULATION_USER = SIMULATION_USER; exports.StrategyType = StrategyType; 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.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.derivePosition = derivePosition; exports.derivePresetParameter = derivePresetParameter; exports.deriveReserve = deriveReserve; exports.findNextBinArrayIndexWithLiquidity = findNextBinArrayIndexWithLiquidity; exports.findNextBinArrayWithLiquidity = findNextBinArrayWithLiquidity; exports.fromStrategyParamstoWeightDistribution = fromStrategyParamstoWeightDistribution; 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.parabolicParameter = parabolicParameter; exports.parseLogs = parseLogs; exports.spotParameter = spotParameter; exports.swapQuoteAtBin = swapQuoteAtBin; exports.toStrategyParameters = toStrategyParameters; exports.toWeightDistribution = toWeightDistribution; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.wrapSOLInstruction = wrapSOLInstruction;
8231
8297
  //# sourceMappingURL=index.js.map