@meteora-ag/dlmm 1.0.55 → 1.1.0

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
@@ -5791,7 +5791,7 @@ declare class DLMM {
5791
5791
  * - `maxInAmount`: Maximum amount of lamport to swap in
5792
5792
  * - `binArraysPubkey`: Array of bin arrays involved in the swap
5793
5793
  */
5794
- swapQuoteExactOut(outAmount: BN, swapForY: boolean, allowedSlippage: BN, binArrays: BinArrayAccount[]): SwapQuoteExactOut;
5794
+ swapQuoteExactOut(outAmount: BN, swapForY: boolean, allowedSlippage: BN, binArrays: BinArrayAccount[], swapInitiator?: PublicKey): SwapQuoteExactOut;
5795
5795
  /**
5796
5796
  * The `swapQuote` function returns a quote for a swap
5797
5797
  * @param
@@ -5809,7 +5809,7 @@ declare class DLMM {
5809
5809
  * - `priceImpact`: Price impact of the swap
5810
5810
  * - `binArraysPubkey`: Array of bin arrays involved in the swap
5811
5811
  */
5812
- swapQuote(inAmount: BN, swapForY: boolean, allowedSlippage: BN, binArrays: BinArrayAccount[], isPartialFill?: boolean): SwapQuote;
5812
+ swapQuote(inAmount: BN, swapForY: boolean, allowedSlippage: BN, binArrays: BinArrayAccount[], isPartialFill?: boolean, swapInitiator?: PublicKey): SwapQuote;
5813
5813
  swapExactOut({ inToken, outToken, outAmount, maxInAmount, lbPair, user, binArraysPubkey, }: SwapExactOutParams): Promise<Transaction>;
5814
5814
  /**
5815
5815
  * Returns a transaction to be signed and sent by user performing swap.
package/dist/index.js CHANGED
@@ -7503,13 +7503,17 @@ var DLMM = class {
7503
7503
  this.clock = clock;
7504
7504
  this.opt = opt;
7505
7505
  }
7506
- validateSwapActivation() {
7506
+ validateSwapActivation(swapInitiator) {
7507
7507
  if (this.lbPair.status == 1 /* Disabled */) {
7508
7508
  throw new Error("Pair is disabled");
7509
7509
  }
7510
7510
  if (this.lbPair.pairType == 1 /* Permissioned */) {
7511
7511
  const currentPoint = this.lbPair.activationType == 0 /* Slot */ ? this.clock.slot : this.clock.unixTimestamp;
7512
- if (currentPoint < this.lbPair.activationPoint) {
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) {
7513
7517
  throw new Error("Pair is disabled");
7514
7518
  }
7515
7519
  }
@@ -9867,10 +9871,10 @@ var DLMM = class {
9867
9871
  * - `maxInAmount`: Maximum amount of lamport to swap in
9868
9872
  * - `binArraysPubkey`: Array of bin arrays involved in the swap
9869
9873
  */
9870
- swapQuoteExactOut(outAmount, swapForY, allowedSlippage, binArrays) {
9874
+ swapQuoteExactOut(outAmount, swapForY, allowedSlippage, binArrays, swapInitiator) {
9871
9875
  const currentTimestamp = Date.now() / 1e3;
9872
9876
  let outAmountLeft = outAmount;
9873
- this.validateSwapActivation();
9877
+ this.validateSwapActivation(_nullishCoalesce(swapInitiator, () => ( _web3js.PublicKey.default)));
9874
9878
  let vParameterClone = Object.assign({}, this.lbPair.vParameters);
9875
9879
  let activeId = new (0, _anchor.BN)(this.lbPair.activeId);
9876
9880
  const binStep = this.lbPair.binStep;
@@ -9968,10 +9972,10 @@ var DLMM = class {
9968
9972
  * - `priceImpact`: Price impact of the swap
9969
9973
  * - `binArraysPubkey`: Array of bin arrays involved in the swap
9970
9974
  */
9971
- swapQuote(inAmount, swapForY, allowedSlippage, binArrays, isPartialFill) {
9975
+ swapQuote(inAmount, swapForY, allowedSlippage, binArrays, isPartialFill, swapInitiator) {
9972
9976
  const currentTimestamp = Date.now() / 1e3;
9973
9977
  let inAmountLeft = inAmount;
9974
- this.validateSwapActivation();
9978
+ this.validateSwapActivation(_nullishCoalesce(swapInitiator, () => ( _web3js.PublicKey.default)));
9975
9979
  let vParameterClone = Object.assign({}, this.lbPair.vParameters);
9976
9980
  let activeId = new (0, _anchor.BN)(this.lbPair.activeId);
9977
9981
  const binStep = this.lbPair.binStep;