@meteora-ag/dlmm 1.1.0 → 1.1.1

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
@@ -5490,7 +5490,6 @@ declare class DLMM {
5490
5490
  clock: Clock;
5491
5491
  private opt?;
5492
5492
  constructor(pubkey: PublicKey, program: ClmmProgram, lbPair: LbPair, binArrayBitmapExtension: BinArrayBitmapExtensionAccount | null, tokenX: TokenReserve, tokenY: TokenReserve, clock: Clock, opt?: Opt);
5493
- private validateSwapActivation;
5494
5493
  /** Static public method */
5495
5494
  /**
5496
5495
  * The function `getLbPairs` retrieves a list of LB pair accounts using a connection and optional
@@ -5791,7 +5790,7 @@ declare class DLMM {
5791
5790
  * - `maxInAmount`: Maximum amount of lamport to swap in
5792
5791
  * - `binArraysPubkey`: Array of bin arrays involved in the swap
5793
5792
  */
5794
- swapQuoteExactOut(outAmount: BN, swapForY: boolean, allowedSlippage: BN, binArrays: BinArrayAccount[], swapInitiator?: PublicKey): SwapQuoteExactOut;
5793
+ swapQuoteExactOut(outAmount: BN, swapForY: boolean, allowedSlippage: BN, binArrays: BinArrayAccount[]): SwapQuoteExactOut;
5795
5794
  /**
5796
5795
  * The `swapQuote` function returns a quote for a swap
5797
5796
  * @param
@@ -5809,7 +5808,7 @@ declare class DLMM {
5809
5808
  * - `priceImpact`: Price impact of the swap
5810
5809
  * - `binArraysPubkey`: Array of bin arrays involved in the swap
5811
5810
  */
5812
- swapQuote(inAmount: BN, swapForY: boolean, allowedSlippage: BN, binArrays: BinArrayAccount[], isPartialFill?: boolean, swapInitiator?: PublicKey): SwapQuote;
5811
+ swapQuote(inAmount: BN, swapForY: boolean, allowedSlippage: BN, binArrays: BinArrayAccount[], isPartialFill?: boolean): SwapQuote;
5813
5812
  swapExactOut({ inToken, outToken, outAmount, maxInAmount, lbPair, user, binArraysPubkey, }: SwapExactOutParams): Promise<Transaction>;
5814
5813
  /**
5815
5814
  * Returns a transaction to be signed and sent by user performing swap.
@@ -5970,6 +5969,12 @@ declare class DLMM {
5970
5969
  withdrawAmount: BN;
5971
5970
  };
5972
5971
  getWithdrawSingleSideAmount(positionPubkey: PublicKey, isWithdrawForY: boolean): Promise<BN>;
5972
+ /**
5973
+ *
5974
+ * @param swapInitiator Address of the swap initiator
5975
+ * @returns
5976
+ */
5977
+ isSwapDisabled(swapInitiator: PublicKey): boolean;
5973
5978
  /** Private static method */
5974
5979
  private static getBinArrays;
5975
5980
  private static getClaimableLMReward;
package/dist/index.js CHANGED
@@ -7503,21 +7503,6 @@ var DLMM = class {
7503
7503
  this.clock = clock;
7504
7504
  this.opt = opt;
7505
7505
  }
7506
- validateSwapActivation(swapInitiator) {
7507
- if (this.lbPair.status == 1 /* Disabled */) {
7508
- throw new Error("Pair is disabled");
7509
- }
7510
- if (this.lbPair.pairType == 1 /* Permissioned */) {
7511
- const currentPoint = this.lbPair.activationType == 0 /* Slot */ ? this.clock.slot : this.clock.unixTimestamp;
7512
- const preActivationSwapPoint = this.lbPair.activationPoint.sub(
7513
- this.lbPair.preActivationDuration
7514
- );
7515
- const activationPoint = !this.lbPair.whitelistedWallet.equals(_web3js.PublicKey.default) && this.lbPair.whitelistedWallet.equals(swapInitiator) ? preActivationSwapPoint : this.lbPair.activationPoint;
7516
- if (currentPoint < activationPoint) {
7517
- throw new Error("Pair is disabled");
7518
- }
7519
- }
7520
- }
7521
7506
  /** Static public method */
7522
7507
  /**
7523
7508
  * The function `getLbPairs` retrieves a list of LB pair accounts using a connection and optional
@@ -9871,10 +9856,9 @@ var DLMM = class {
9871
9856
  * - `maxInAmount`: Maximum amount of lamport to swap in
9872
9857
  * - `binArraysPubkey`: Array of bin arrays involved in the swap
9873
9858
  */
9874
- swapQuoteExactOut(outAmount, swapForY, allowedSlippage, binArrays, swapInitiator) {
9859
+ swapQuoteExactOut(outAmount, swapForY, allowedSlippage, binArrays) {
9875
9860
  const currentTimestamp = Date.now() / 1e3;
9876
9861
  let outAmountLeft = outAmount;
9877
- this.validateSwapActivation(_nullishCoalesce(swapInitiator, () => ( _web3js.PublicKey.default)));
9878
9862
  let vParameterClone = Object.assign({}, this.lbPair.vParameters);
9879
9863
  let activeId = new (0, _anchor.BN)(this.lbPair.activeId);
9880
9864
  const binStep = this.lbPair.binStep;
@@ -9972,10 +9956,9 @@ var DLMM = class {
9972
9956
  * - `priceImpact`: Price impact of the swap
9973
9957
  * - `binArraysPubkey`: Array of bin arrays involved in the swap
9974
9958
  */
9975
- swapQuote(inAmount, swapForY, allowedSlippage, binArrays, isPartialFill, swapInitiator) {
9959
+ swapQuote(inAmount, swapForY, allowedSlippage, binArrays, isPartialFill) {
9976
9960
  const currentTimestamp = Date.now() / 1e3;
9977
9961
  let inAmountLeft = inAmount;
9978
- this.validateSwapActivation(_nullishCoalesce(swapInitiator, () => ( _web3js.PublicKey.default)));
9979
9962
  let vParameterClone = Object.assign({}, this.lbPair.vParameters);
9980
9963
  let activeId = new (0, _anchor.BN)(this.lbPair.activeId);
9981
9964
  const binStep = this.lbPair.binStep;
@@ -11151,6 +11134,27 @@ var DLMM = class {
11151
11134
  }
11152
11135
  return totalWithdrawAmount;
11153
11136
  }
11137
+ /**
11138
+ *
11139
+ * @param swapInitiator Address of the swap initiator
11140
+ * @returns
11141
+ */
11142
+ isSwapDisabled(swapInitiator) {
11143
+ if (this.lbPair.status == 1 /* Disabled */) {
11144
+ return true;
11145
+ }
11146
+ if (this.lbPair.pairType == 1 /* Permissioned */) {
11147
+ const currentPoint = this.lbPair.activationType == 0 /* Slot */ ? this.clock.slot : this.clock.unixTimestamp;
11148
+ const preActivationSwapPoint = this.lbPair.activationPoint.sub(
11149
+ this.lbPair.preActivationDuration
11150
+ );
11151
+ const activationPoint = !this.lbPair.whitelistedWallet.equals(_web3js.PublicKey.default) && this.lbPair.whitelistedWallet.equals(swapInitiator) ? preActivationSwapPoint : this.lbPair.activationPoint;
11152
+ if (currentPoint < activationPoint) {
11153
+ return true;
11154
+ }
11155
+ }
11156
+ return false;
11157
+ }
11154
11158
  /** Private static method */
11155
11159
  static async getBinArrays(program, lbPairPubkey) {
11156
11160
  return program.account.binArray.all([