@meteora-ag/dlmm 1.0.56-rc.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 +6 -1
- package/dist/index.js +21 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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
|
|
@@ -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,17 +7503,6 @@ var DLMM = class {
|
|
|
7503
7503
|
this.clock = clock;
|
|
7504
7504
|
this.opt = opt;
|
|
7505
7505
|
}
|
|
7506
|
-
validateSwapActivation() {
|
|
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
|
-
if (currentPoint < this.lbPair.activationPoint) {
|
|
7513
|
-
throw new Error("Pair is disabled");
|
|
7514
|
-
}
|
|
7515
|
-
}
|
|
7516
|
-
}
|
|
7517
7506
|
/** Static public method */
|
|
7518
7507
|
/**
|
|
7519
7508
|
* The function `getLbPairs` retrieves a list of LB pair accounts using a connection and optional
|
|
@@ -9870,7 +9859,6 @@ var DLMM = class {
|
|
|
9870
9859
|
swapQuoteExactOut(outAmount, swapForY, allowedSlippage, binArrays) {
|
|
9871
9860
|
const currentTimestamp = Date.now() / 1e3;
|
|
9872
9861
|
let outAmountLeft = outAmount;
|
|
9873
|
-
this.validateSwapActivation();
|
|
9874
9862
|
let vParameterClone = Object.assign({}, this.lbPair.vParameters);
|
|
9875
9863
|
let activeId = new (0, _anchor.BN)(this.lbPair.activeId);
|
|
9876
9864
|
const binStep = this.lbPair.binStep;
|
|
@@ -9971,7 +9959,6 @@ var DLMM = class {
|
|
|
9971
9959
|
swapQuote(inAmount, swapForY, allowedSlippage, binArrays, isPartialFill) {
|
|
9972
9960
|
const currentTimestamp = Date.now() / 1e3;
|
|
9973
9961
|
let inAmountLeft = inAmount;
|
|
9974
|
-
this.validateSwapActivation();
|
|
9975
9962
|
let vParameterClone = Object.assign({}, this.lbPair.vParameters);
|
|
9976
9963
|
let activeId = new (0, _anchor.BN)(this.lbPair.activeId);
|
|
9977
9964
|
const binStep = this.lbPair.binStep;
|
|
@@ -11147,6 +11134,27 @@ var DLMM = class {
|
|
|
11147
11134
|
}
|
|
11148
11135
|
return totalWithdrawAmount;
|
|
11149
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
|
+
}
|
|
11150
11158
|
/** Private static method */
|
|
11151
11159
|
static async getBinArrays(program, lbPairPubkey) {
|
|
11152
11160
|
return program.account.binArray.all([
|