@meteora-ag/dlmm 1.0.51 → 1.0.52-rc.7
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 +91 -14
- package/dist/index.js +253 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +253 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -2044,6 +2044,73 @@ type LbClmm = {
|
|
|
2044
2044
|
];
|
|
2045
2045
|
"args": [];
|
|
2046
2046
|
},
|
|
2047
|
+
{
|
|
2048
|
+
"name": "removeLiquiditySingleSide";
|
|
2049
|
+
"accounts": [
|
|
2050
|
+
{
|
|
2051
|
+
"name": "position";
|
|
2052
|
+
"isMut": true;
|
|
2053
|
+
"isSigner": false;
|
|
2054
|
+
},
|
|
2055
|
+
{
|
|
2056
|
+
"name": "lbPair";
|
|
2057
|
+
"isMut": true;
|
|
2058
|
+
"isSigner": false;
|
|
2059
|
+
},
|
|
2060
|
+
{
|
|
2061
|
+
"name": "binArrayBitmapExtension";
|
|
2062
|
+
"isMut": true;
|
|
2063
|
+
"isSigner": false;
|
|
2064
|
+
"isOptional": true;
|
|
2065
|
+
},
|
|
2066
|
+
{
|
|
2067
|
+
"name": "userToken";
|
|
2068
|
+
"isMut": true;
|
|
2069
|
+
"isSigner": false;
|
|
2070
|
+
},
|
|
2071
|
+
{
|
|
2072
|
+
"name": "reserve";
|
|
2073
|
+
"isMut": true;
|
|
2074
|
+
"isSigner": false;
|
|
2075
|
+
},
|
|
2076
|
+
{
|
|
2077
|
+
"name": "tokenMint";
|
|
2078
|
+
"isMut": false;
|
|
2079
|
+
"isSigner": false;
|
|
2080
|
+
},
|
|
2081
|
+
{
|
|
2082
|
+
"name": "binArrayLower";
|
|
2083
|
+
"isMut": true;
|
|
2084
|
+
"isSigner": false;
|
|
2085
|
+
},
|
|
2086
|
+
{
|
|
2087
|
+
"name": "binArrayUpper";
|
|
2088
|
+
"isMut": true;
|
|
2089
|
+
"isSigner": false;
|
|
2090
|
+
},
|
|
2091
|
+
{
|
|
2092
|
+
"name": "sender";
|
|
2093
|
+
"isMut": false;
|
|
2094
|
+
"isSigner": true;
|
|
2095
|
+
},
|
|
2096
|
+
{
|
|
2097
|
+
"name": "tokenProgram";
|
|
2098
|
+
"isMut": false;
|
|
2099
|
+
"isSigner": false;
|
|
2100
|
+
},
|
|
2101
|
+
{
|
|
2102
|
+
"name": "eventAuthority";
|
|
2103
|
+
"isMut": false;
|
|
2104
|
+
"isSigner": false;
|
|
2105
|
+
},
|
|
2106
|
+
{
|
|
2107
|
+
"name": "program";
|
|
2108
|
+
"isMut": false;
|
|
2109
|
+
"isSigner": false;
|
|
2110
|
+
}
|
|
2111
|
+
];
|
|
2112
|
+
"args": [];
|
|
2113
|
+
},
|
|
2047
2114
|
{
|
|
2048
2115
|
"name": "togglePairStatus";
|
|
2049
2116
|
"accounts": [
|
|
@@ -3720,38 +3787,38 @@ type LbClmm = {
|
|
|
3720
3787
|
};
|
|
3721
3788
|
},
|
|
3722
3789
|
{
|
|
3723
|
-
"name": "
|
|
3790
|
+
"name": "FeeParameter";
|
|
3724
3791
|
"type": {
|
|
3725
3792
|
"kind": "struct";
|
|
3726
3793
|
"fields": [
|
|
3727
3794
|
{
|
|
3728
|
-
"name": "
|
|
3729
|
-
"
|
|
3795
|
+
"name": "protocolShare";
|
|
3796
|
+
"docs": [
|
|
3797
|
+
"Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee"
|
|
3798
|
+
];
|
|
3799
|
+
"type": "u16";
|
|
3730
3800
|
},
|
|
3731
3801
|
{
|
|
3732
|
-
"name": "
|
|
3802
|
+
"name": "baseFactor";
|
|
3803
|
+
"docs": [
|
|
3804
|
+
"Base factor for base fee rate"
|
|
3805
|
+
];
|
|
3733
3806
|
"type": "u16";
|
|
3734
3807
|
}
|
|
3735
3808
|
];
|
|
3736
3809
|
};
|
|
3737
3810
|
},
|
|
3738
3811
|
{
|
|
3739
|
-
"name": "
|
|
3812
|
+
"name": "BinLiquidityReduction";
|
|
3740
3813
|
"type": {
|
|
3741
3814
|
"kind": "struct";
|
|
3742
3815
|
"fields": [
|
|
3743
3816
|
{
|
|
3744
|
-
"name": "
|
|
3745
|
-
"
|
|
3746
|
-
"Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee"
|
|
3747
|
-
];
|
|
3748
|
-
"type": "u16";
|
|
3817
|
+
"name": "binId";
|
|
3818
|
+
"type": "i32";
|
|
3749
3819
|
},
|
|
3750
3820
|
{
|
|
3751
|
-
"name": "
|
|
3752
|
-
"docs": [
|
|
3753
|
-
"Base factor for base fee rate"
|
|
3754
|
-
];
|
|
3821
|
+
"name": "bpsToRemove";
|
|
3755
3822
|
"type": "u16";
|
|
3756
3823
|
}
|
|
3757
3824
|
];
|
|
@@ -5648,6 +5715,12 @@ declare class DLMM {
|
|
|
5648
5715
|
bps: BN;
|
|
5649
5716
|
shouldClaimAndClose?: boolean;
|
|
5650
5717
|
}): Promise<Transaction | Transaction[]>;
|
|
5718
|
+
removeLiquiditySingleSide({ user, position, binIds, removeLiquidityForY, }: {
|
|
5719
|
+
user: PublicKey;
|
|
5720
|
+
position: PublicKey;
|
|
5721
|
+
binIds: number[];
|
|
5722
|
+
removeLiquidityForY?: boolean;
|
|
5723
|
+
}): Promise<Transaction | Transaction[]>;
|
|
5651
5724
|
/**
|
|
5652
5725
|
* The `closePosition` function closes a position
|
|
5653
5726
|
* @param
|
|
@@ -5848,6 +5921,10 @@ declare class DLMM {
|
|
|
5848
5921
|
*/
|
|
5849
5922
|
syncWithMarketPrice(marketPrice: number, owner: PublicKey): Promise<Transaction>;
|
|
5850
5923
|
getMaxPriceInBinArrays(binArrayAccounts: BinArrayAccount[]): Promise<string>;
|
|
5924
|
+
getAmountOutWithdrawSingleSide(maxLiquidityShare: BN, price: BN, bin: Bin, isWithdrawForY: boolean): {
|
|
5925
|
+
withdrawAmount: BN;
|
|
5926
|
+
};
|
|
5927
|
+
getWithdrawSingleSideAmount(positionPubkey: PublicKey, isWithdrawForY: boolean): Promise<BN>;
|
|
5851
5928
|
/** Private static method */
|
|
5852
5929
|
private static getBinArrays;
|
|
5853
5930
|
private static getClaimableLMReward;
|
package/dist/index.js
CHANGED
|
@@ -2048,6 +2048,73 @@ var IDL = {
|
|
|
2048
2048
|
],
|
|
2049
2049
|
"args": []
|
|
2050
2050
|
},
|
|
2051
|
+
{
|
|
2052
|
+
"name": "removeLiquiditySingleSide",
|
|
2053
|
+
"accounts": [
|
|
2054
|
+
{
|
|
2055
|
+
"name": "position",
|
|
2056
|
+
"isMut": true,
|
|
2057
|
+
"isSigner": false
|
|
2058
|
+
},
|
|
2059
|
+
{
|
|
2060
|
+
"name": "lbPair",
|
|
2061
|
+
"isMut": true,
|
|
2062
|
+
"isSigner": false
|
|
2063
|
+
},
|
|
2064
|
+
{
|
|
2065
|
+
"name": "binArrayBitmapExtension",
|
|
2066
|
+
"isMut": true,
|
|
2067
|
+
"isSigner": false,
|
|
2068
|
+
"isOptional": true
|
|
2069
|
+
},
|
|
2070
|
+
{
|
|
2071
|
+
"name": "userToken",
|
|
2072
|
+
"isMut": true,
|
|
2073
|
+
"isSigner": false
|
|
2074
|
+
},
|
|
2075
|
+
{
|
|
2076
|
+
"name": "reserve",
|
|
2077
|
+
"isMut": true,
|
|
2078
|
+
"isSigner": false
|
|
2079
|
+
},
|
|
2080
|
+
{
|
|
2081
|
+
"name": "tokenMint",
|
|
2082
|
+
"isMut": false,
|
|
2083
|
+
"isSigner": false
|
|
2084
|
+
},
|
|
2085
|
+
{
|
|
2086
|
+
"name": "binArrayLower",
|
|
2087
|
+
"isMut": true,
|
|
2088
|
+
"isSigner": false
|
|
2089
|
+
},
|
|
2090
|
+
{
|
|
2091
|
+
"name": "binArrayUpper",
|
|
2092
|
+
"isMut": true,
|
|
2093
|
+
"isSigner": false
|
|
2094
|
+
},
|
|
2095
|
+
{
|
|
2096
|
+
"name": "sender",
|
|
2097
|
+
"isMut": false,
|
|
2098
|
+
"isSigner": true
|
|
2099
|
+
},
|
|
2100
|
+
{
|
|
2101
|
+
"name": "tokenProgram",
|
|
2102
|
+
"isMut": false,
|
|
2103
|
+
"isSigner": false
|
|
2104
|
+
},
|
|
2105
|
+
{
|
|
2106
|
+
"name": "eventAuthority",
|
|
2107
|
+
"isMut": false,
|
|
2108
|
+
"isSigner": false
|
|
2109
|
+
},
|
|
2110
|
+
{
|
|
2111
|
+
"name": "program",
|
|
2112
|
+
"isMut": false,
|
|
2113
|
+
"isSigner": false
|
|
2114
|
+
}
|
|
2115
|
+
],
|
|
2116
|
+
"args": []
|
|
2117
|
+
},
|
|
2051
2118
|
{
|
|
2052
2119
|
"name": "togglePairStatus",
|
|
2053
2120
|
"accounts": [
|
|
@@ -3724,38 +3791,38 @@ var IDL = {
|
|
|
3724
3791
|
}
|
|
3725
3792
|
},
|
|
3726
3793
|
{
|
|
3727
|
-
"name": "
|
|
3794
|
+
"name": "FeeParameter",
|
|
3728
3795
|
"type": {
|
|
3729
3796
|
"kind": "struct",
|
|
3730
3797
|
"fields": [
|
|
3731
3798
|
{
|
|
3732
|
-
"name": "
|
|
3733
|
-
"
|
|
3799
|
+
"name": "protocolShare",
|
|
3800
|
+
"docs": [
|
|
3801
|
+
"Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee"
|
|
3802
|
+
],
|
|
3803
|
+
"type": "u16"
|
|
3734
3804
|
},
|
|
3735
3805
|
{
|
|
3736
|
-
"name": "
|
|
3806
|
+
"name": "baseFactor",
|
|
3807
|
+
"docs": [
|
|
3808
|
+
"Base factor for base fee rate"
|
|
3809
|
+
],
|
|
3737
3810
|
"type": "u16"
|
|
3738
3811
|
}
|
|
3739
3812
|
]
|
|
3740
3813
|
}
|
|
3741
3814
|
},
|
|
3742
3815
|
{
|
|
3743
|
-
"name": "
|
|
3816
|
+
"name": "BinLiquidityReduction",
|
|
3744
3817
|
"type": {
|
|
3745
3818
|
"kind": "struct",
|
|
3746
3819
|
"fields": [
|
|
3747
3820
|
{
|
|
3748
|
-
"name": "
|
|
3749
|
-
"
|
|
3750
|
-
"Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee"
|
|
3751
|
-
],
|
|
3752
|
-
"type": "u16"
|
|
3821
|
+
"name": "binId",
|
|
3822
|
+
"type": "i32"
|
|
3753
3823
|
},
|
|
3754
3824
|
{
|
|
3755
|
-
"name": "
|
|
3756
|
-
"docs": [
|
|
3757
|
-
"Base factor for base fee rate"
|
|
3758
|
-
],
|
|
3825
|
+
"name": "bpsToRemove",
|
|
3759
3826
|
"type": "u16"
|
|
3760
3827
|
}
|
|
3761
3828
|
]
|
|
@@ -9604,6 +9671,76 @@ var DLMM = class {
|
|
|
9604
9671
|
}).add(removeLiquidityTx);
|
|
9605
9672
|
}
|
|
9606
9673
|
}
|
|
9674
|
+
async removeLiquiditySingleSide({
|
|
9675
|
+
user,
|
|
9676
|
+
position,
|
|
9677
|
+
binIds,
|
|
9678
|
+
removeLiquidityForY = false
|
|
9679
|
+
}) {
|
|
9680
|
+
const { lbPair, lowerBinId, owner, feeOwner } = await this.program.account.positionV2.fetch(position);
|
|
9681
|
+
const { reserveX, reserveY, tokenXMint, tokenYMint } = await this.program.account.lbPair.fetch(lbPair);
|
|
9682
|
+
const lowerBinArrayIndex = binIdToBinArrayIndex(new (0, _anchor.BN)(lowerBinId));
|
|
9683
|
+
const upperBinArrayIndex = lowerBinArrayIndex.add(new (0, _anchor.BN)(1));
|
|
9684
|
+
const [binArrayLower] = deriveBinArray(
|
|
9685
|
+
lbPair,
|
|
9686
|
+
lowerBinArrayIndex,
|
|
9687
|
+
this.program.programId
|
|
9688
|
+
);
|
|
9689
|
+
const [binArrayUpper] = deriveBinArray(
|
|
9690
|
+
lbPair,
|
|
9691
|
+
upperBinArrayIndex,
|
|
9692
|
+
this.program.programId
|
|
9693
|
+
);
|
|
9694
|
+
const preInstructions = [];
|
|
9695
|
+
const setComputeUnitLimitIx = computeBudgetIx();
|
|
9696
|
+
preInstructions.push(setComputeUnitLimitIx);
|
|
9697
|
+
const { ataPubKey: userToken, ix: createPayerTokenIx } = removeLiquidityForY ? await getOrCreateATAInstruction(
|
|
9698
|
+
this.program.provider.connection,
|
|
9699
|
+
this.tokenY.publicKey,
|
|
9700
|
+
owner,
|
|
9701
|
+
user
|
|
9702
|
+
) : await getOrCreateATAInstruction(
|
|
9703
|
+
this.program.provider.connection,
|
|
9704
|
+
this.tokenX.publicKey,
|
|
9705
|
+
owner,
|
|
9706
|
+
user
|
|
9707
|
+
);
|
|
9708
|
+
createPayerTokenIx && preInstructions.push(createPayerTokenIx);
|
|
9709
|
+
const postInstructions = [];
|
|
9710
|
+
if ([
|
|
9711
|
+
this.tokenX.publicKey.toBase58(),
|
|
9712
|
+
this.tokenY.publicKey.toBase58()
|
|
9713
|
+
].includes(_spltoken.NATIVE_MINT.toBase58())) {
|
|
9714
|
+
const closeWrappedSOLIx = await unwrapSOLInstruction(user);
|
|
9715
|
+
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
9716
|
+
}
|
|
9717
|
+
const minBinId = Math.min(...binIds);
|
|
9718
|
+
const maxBinId = Math.max(...binIds);
|
|
9719
|
+
const minBinArrayIndex = binIdToBinArrayIndex(new (0, _anchor.BN)(minBinId));
|
|
9720
|
+
const maxBinArrayIndex = binIdToBinArrayIndex(new (0, _anchor.BN)(maxBinId));
|
|
9721
|
+
const useExtension = isOverflowDefaultBinArrayBitmap(minBinArrayIndex) || isOverflowDefaultBinArrayBitmap(maxBinArrayIndex);
|
|
9722
|
+
const binArrayBitmapExtension = useExtension ? deriveBinArrayBitmapExtension(this.pubkey, this.program.programId)[0] : null;
|
|
9723
|
+
const reserve = removeLiquidityForY ? reserveY : reserveX;
|
|
9724
|
+
const tokenMint = removeLiquidityForY ? tokenYMint : tokenXMint;
|
|
9725
|
+
const removeLiquiditySingleSideTx = await this.program.methods.removeLiquiditySingleSide().accounts({
|
|
9726
|
+
position,
|
|
9727
|
+
lbPair,
|
|
9728
|
+
binArrayBitmapExtension,
|
|
9729
|
+
userToken,
|
|
9730
|
+
reserve,
|
|
9731
|
+
tokenMint,
|
|
9732
|
+
binArrayLower,
|
|
9733
|
+
binArrayUpper,
|
|
9734
|
+
sender: user,
|
|
9735
|
+
tokenProgram: _spltoken.TOKEN_PROGRAM_ID
|
|
9736
|
+
}).preInstructions(preInstructions).transaction();
|
|
9737
|
+
const { blockhash, lastValidBlockHeight } = await this.program.provider.connection.getLatestBlockhash("confirmed");
|
|
9738
|
+
return new (0, _web3js.Transaction)({
|
|
9739
|
+
blockhash,
|
|
9740
|
+
lastValidBlockHeight,
|
|
9741
|
+
feePayer: user
|
|
9742
|
+
}).add(removeLiquiditySingleSideTx);
|
|
9743
|
+
}
|
|
9607
9744
|
/**
|
|
9608
9745
|
* The `closePosition` function closes a position
|
|
9609
9746
|
* @param
|
|
@@ -10823,6 +10960,108 @@ var DLMM = class {
|
|
|
10823
10960
|
Number(binPriceWithLastLiquidity) / (2 ** 64 - 1)
|
|
10824
10961
|
);
|
|
10825
10962
|
}
|
|
10963
|
+
getAmountOutWithdrawSingleSide(maxLiquidityShare, price, bin, isWithdrawForY) {
|
|
10964
|
+
const amountX = mulDiv(
|
|
10965
|
+
maxLiquidityShare,
|
|
10966
|
+
bin.amountX,
|
|
10967
|
+
bin.liquiditySupply,
|
|
10968
|
+
1 /* Down */
|
|
10969
|
+
);
|
|
10970
|
+
const amountY = mulDiv(
|
|
10971
|
+
maxLiquidityShare,
|
|
10972
|
+
bin.amountY,
|
|
10973
|
+
bin.liquiditySupply,
|
|
10974
|
+
1 /* Down */
|
|
10975
|
+
);
|
|
10976
|
+
const amount0 = isWithdrawForY ? amountX : amountY;
|
|
10977
|
+
const amount1 = isWithdrawForY ? amountY : amountX;
|
|
10978
|
+
const remainAmountX = bin.amountX.sub(amountX);
|
|
10979
|
+
const remainAmountY = bin.amountY.sub(amountY);
|
|
10980
|
+
if (amount0.eq(new (0, _anchor.BN)(0))) {
|
|
10981
|
+
return {
|
|
10982
|
+
withdrawAmount: amount1
|
|
10983
|
+
};
|
|
10984
|
+
}
|
|
10985
|
+
let maxAmountOut = isWithdrawForY ? remainAmountY : remainAmountX;
|
|
10986
|
+
let maxAmountIn = isWithdrawForY ? shlDiv(remainAmountY, price, SCALE_OFFSET, 0 /* Up */) : mulShr(remainAmountX, price, SCALE_OFFSET, 0 /* Up */);
|
|
10987
|
+
let maxFee = computeFee(
|
|
10988
|
+
this.lbPair.binStep,
|
|
10989
|
+
this.lbPair.parameters,
|
|
10990
|
+
this.lbPair.vParameters,
|
|
10991
|
+
maxAmountIn
|
|
10992
|
+
);
|
|
10993
|
+
maxAmountIn = maxAmountIn.add(maxFee);
|
|
10994
|
+
if (amount0.gt(maxAmountIn)) {
|
|
10995
|
+
return {
|
|
10996
|
+
withdrawAmount: maxAmountOut
|
|
10997
|
+
};
|
|
10998
|
+
}
|
|
10999
|
+
const fee = computeFeeFromAmount(
|
|
11000
|
+
this.lbPair.binStep,
|
|
11001
|
+
this.lbPair.parameters,
|
|
11002
|
+
this.lbPair.vParameters,
|
|
11003
|
+
amount0
|
|
11004
|
+
);
|
|
11005
|
+
const amount0AfterFee = amount0.sub(fee);
|
|
11006
|
+
const amountOut = isWithdrawForY ? mulShr(price, amount0AfterFee, SCALE_OFFSET, 1 /* Down */) : shlDiv(amount0AfterFee, price, SCALE_OFFSET, 1 /* Down */);
|
|
11007
|
+
return {
|
|
11008
|
+
withdrawAmount: amount1.add(amountOut > maxAmountOut ? maxAmountOut : amountOut)
|
|
11009
|
+
};
|
|
11010
|
+
}
|
|
11011
|
+
async getWithdrawSingleSideAmount(positionPubkey, isWithdrawForY) {
|
|
11012
|
+
let totalWithdrawAmount = new (0, _anchor.BN)(0);
|
|
11013
|
+
let _lowerBinArray;
|
|
11014
|
+
let _upperBinArray;
|
|
11015
|
+
const position = await this.program.account.positionV2.fetch(
|
|
11016
|
+
positionPubkey
|
|
11017
|
+
);
|
|
11018
|
+
const lowerBinArrayIdx = binIdToBinArrayIndex(new (0, _anchor.BN)(position.lowerBinId));
|
|
11019
|
+
const [lowerBinArray] = deriveBinArray(
|
|
11020
|
+
position.lbPair,
|
|
11021
|
+
lowerBinArrayIdx,
|
|
11022
|
+
this.program.programId
|
|
11023
|
+
);
|
|
11024
|
+
const upperBinArrayIdx = lowerBinArrayIdx.add(new (0, _anchor.BN)(1));
|
|
11025
|
+
const [upperBinArray] = deriveBinArray(
|
|
11026
|
+
position.lbPair,
|
|
11027
|
+
upperBinArrayIdx,
|
|
11028
|
+
this.program.programId
|
|
11029
|
+
);
|
|
11030
|
+
[_lowerBinArray, _upperBinArray] = await this.program.account.binArray.fetchMultiple([
|
|
11031
|
+
lowerBinArray,
|
|
11032
|
+
upperBinArray
|
|
11033
|
+
]);
|
|
11034
|
+
if (!_lowerBinArray || !_upperBinArray)
|
|
11035
|
+
throw new Error("BinArray not found");
|
|
11036
|
+
for (let idx = 0; idx < position.liquidityShares.length; idx++) {
|
|
11037
|
+
const shareToRemove = position.liquidityShares[idx];
|
|
11038
|
+
if (shareToRemove.eq(new (0, _anchor.BN)(0))) {
|
|
11039
|
+
continue;
|
|
11040
|
+
}
|
|
11041
|
+
const binId = new (0, _anchor.BN)(position.lowerBinId).add(new (0, _anchor.BN)(idx));
|
|
11042
|
+
const binArrayIndex = binIdToBinArrayIndex(binId);
|
|
11043
|
+
const binArray = binArrayIndex.eq(lowerBinArrayIdx) ? _lowerBinArray : _upperBinArray;
|
|
11044
|
+
const bin = getBinFromBinArray(binId.toNumber(), binArray);
|
|
11045
|
+
if (isWithdrawForY) {
|
|
11046
|
+
if (binId.gt(new (0, _anchor.BN)(this.lbPair.activeId))) {
|
|
11047
|
+
break;
|
|
11048
|
+
}
|
|
11049
|
+
} else {
|
|
11050
|
+
if (binId.lt(new (0, _anchor.BN)(this.lbPair.activeId))) {
|
|
11051
|
+
continue;
|
|
11052
|
+
}
|
|
11053
|
+
}
|
|
11054
|
+
const price = getQPriceFromId(binId, new (0, _anchor.BN)(this.lbPair.binStep));
|
|
11055
|
+
const { withdrawAmount } = this.getAmountOutWithdrawSingleSide(
|
|
11056
|
+
shareToRemove,
|
|
11057
|
+
price,
|
|
11058
|
+
bin,
|
|
11059
|
+
isWithdrawForY
|
|
11060
|
+
);
|
|
11061
|
+
totalWithdrawAmount = totalWithdrawAmount.add(withdrawAmount);
|
|
11062
|
+
}
|
|
11063
|
+
return totalWithdrawAmount;
|
|
11064
|
+
}
|
|
10826
11065
|
/** Private static method */
|
|
10827
11066
|
static async getBinArrays(program, lbPairPubkey) {
|
|
10828
11067
|
return program.account.binArray.all([
|