@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.mjs 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(PublicKey6.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(swapInitiator ?? PublicKey6.default);
9878
9862
  let vParameterClone = Object.assign({}, this.lbPair.vParameters);
9879
9863
  let activeId = new BN9(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(swapInitiator ?? PublicKey6.default);
9979
9962
  let vParameterClone = Object.assign({}, this.lbPair.vParameters);
9980
9963
  let activeId = new BN9(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(PublicKey6.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([