@meteora-ag/dlmm 1.3.9-rc.0 → 1.3.9-rc.5
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 +7 -87
- package/dist/index.js +31 -111
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -110
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5334,15 +5334,6 @@ declare enum PairType {
|
|
|
5334
5334
|
Permissioned = 1
|
|
5335
5335
|
}
|
|
5336
5336
|
declare const Strategy: {
|
|
5337
|
-
SpotOneSide: {
|
|
5338
|
-
spotOneSide: {};
|
|
5339
|
-
};
|
|
5340
|
-
CurveOneSide: {
|
|
5341
|
-
curveOneSide: {};
|
|
5342
|
-
};
|
|
5343
|
-
BidAskOneSide: {
|
|
5344
|
-
bidAskOneSide: {};
|
|
5345
|
-
};
|
|
5346
5337
|
SpotBalanced: {
|
|
5347
5338
|
spotBalanced: {};
|
|
5348
5339
|
};
|
|
@@ -5363,15 +5354,12 @@ declare const Strategy: {
|
|
|
5363
5354
|
};
|
|
5364
5355
|
};
|
|
5365
5356
|
declare enum StrategyType {
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
SpotBalanced = 6,
|
|
5373
|
-
CurveBalanced = 7,
|
|
5374
|
-
BidAskBalanced = 8
|
|
5357
|
+
SpotImBalanced = 0,
|
|
5358
|
+
CurveImBalanced = 1,
|
|
5359
|
+
BidAskImBalanced = 2,
|
|
5360
|
+
SpotBalanced = 3,
|
|
5361
|
+
CurveBalanced = 4,
|
|
5362
|
+
BidAskBalanced = 5
|
|
5375
5363
|
}
|
|
5376
5364
|
declare enum ActivationType {
|
|
5377
5365
|
Slot = 0,
|
|
@@ -6251,10 +6239,6 @@ declare function autoFillXByWeight(activeId: number, binStep: number, amountY: B
|
|
|
6251
6239
|
weight: number;
|
|
6252
6240
|
}[]): BN;
|
|
6253
6241
|
|
|
6254
|
-
declare function toAmountsOneSideByStrategy(activeId: number, binStep: number, minBinId: number, maxBinId: number, amount: BN, strategyType: StrategyType, depositForY: boolean): {
|
|
6255
|
-
binId: number;
|
|
6256
|
-
amount: BN;
|
|
6257
|
-
}[];
|
|
6258
6242
|
declare function toAmountsBothSideByStrategy(activeId: number, binStep: number, minBinId: number, maxBinId: number, amountX: BN, amountY: BN, amountXInActiveBin: BN, amountYInActiveBin: BN, strategyType: StrategyType): {
|
|
6259
6243
|
binId: number;
|
|
6260
6244
|
amountX: BN;
|
|
@@ -6263,58 +6247,10 @@ declare function toAmountsBothSideByStrategy(activeId: number, binStep: number,
|
|
|
6263
6247
|
declare function autoFillYByStrategy(activeId: number, binStep: number, amountX: BN, amountXInActiveBin: BN, amountYInActiveBin: BN, minBinId: number, maxBinId: number, strategyType: StrategyType): BN;
|
|
6264
6248
|
declare function autoFillXByStrategy(activeId: number, binStep: number, amountY: BN, amountXInActiveBin: BN, amountYInActiveBin: BN, minBinId: number, maxBinId: number, strategyType: StrategyType): BN;
|
|
6265
6249
|
declare function toStrategyParameters({ maxBinId, minBinId, strategyType, singleSidedX, }: StrategyParameters): {
|
|
6266
|
-
minBinId: number;
|
|
6267
|
-
maxBinId: number;
|
|
6268
|
-
strategyType: {
|
|
6269
|
-
spotOneSide: {};
|
|
6270
|
-
curveOneSide?: undefined;
|
|
6271
|
-
bidAskOneSide?: undefined;
|
|
6272
|
-
spotBalanced?: undefined;
|
|
6273
|
-
curveBalanced?: undefined;
|
|
6274
|
-
bidAskBalanced?: undefined;
|
|
6275
|
-
spotImBalanced?: undefined;
|
|
6276
|
-
curveImBalanced?: undefined;
|
|
6277
|
-
bidAskImBalanced?: undefined;
|
|
6278
|
-
};
|
|
6279
|
-
parameteres: number[];
|
|
6280
|
-
} | {
|
|
6281
|
-
minBinId: number;
|
|
6282
|
-
maxBinId: number;
|
|
6283
|
-
strategyType: {
|
|
6284
|
-
curveOneSide: {};
|
|
6285
|
-
spotOneSide?: undefined;
|
|
6286
|
-
bidAskOneSide?: undefined;
|
|
6287
|
-
spotBalanced?: undefined;
|
|
6288
|
-
curveBalanced?: undefined;
|
|
6289
|
-
bidAskBalanced?: undefined;
|
|
6290
|
-
spotImBalanced?: undefined;
|
|
6291
|
-
curveImBalanced?: undefined;
|
|
6292
|
-
bidAskImBalanced?: undefined;
|
|
6293
|
-
};
|
|
6294
|
-
parameteres: number[];
|
|
6295
|
-
} | {
|
|
6296
|
-
minBinId: number;
|
|
6297
|
-
maxBinId: number;
|
|
6298
|
-
strategyType: {
|
|
6299
|
-
bidAskOneSide: {};
|
|
6300
|
-
spotOneSide?: undefined;
|
|
6301
|
-
curveOneSide?: undefined;
|
|
6302
|
-
spotBalanced?: undefined;
|
|
6303
|
-
curveBalanced?: undefined;
|
|
6304
|
-
bidAskBalanced?: undefined;
|
|
6305
|
-
spotImBalanced?: undefined;
|
|
6306
|
-
curveImBalanced?: undefined;
|
|
6307
|
-
bidAskImBalanced?: undefined;
|
|
6308
|
-
};
|
|
6309
|
-
parameteres: number[];
|
|
6310
|
-
} | {
|
|
6311
6250
|
minBinId: number;
|
|
6312
6251
|
maxBinId: number;
|
|
6313
6252
|
strategyType: {
|
|
6314
6253
|
spotBalanced: {};
|
|
6315
|
-
spotOneSide?: undefined;
|
|
6316
|
-
curveOneSide?: undefined;
|
|
6317
|
-
bidAskOneSide?: undefined;
|
|
6318
6254
|
curveBalanced?: undefined;
|
|
6319
6255
|
bidAskBalanced?: undefined;
|
|
6320
6256
|
spotImBalanced?: undefined;
|
|
@@ -6327,9 +6263,6 @@ declare function toStrategyParameters({ maxBinId, minBinId, strategyType, single
|
|
|
6327
6263
|
maxBinId: number;
|
|
6328
6264
|
strategyType: {
|
|
6329
6265
|
curveBalanced: {};
|
|
6330
|
-
spotOneSide?: undefined;
|
|
6331
|
-
curveOneSide?: undefined;
|
|
6332
|
-
bidAskOneSide?: undefined;
|
|
6333
6266
|
spotBalanced?: undefined;
|
|
6334
6267
|
bidAskBalanced?: undefined;
|
|
6335
6268
|
spotImBalanced?: undefined;
|
|
@@ -6342,9 +6275,6 @@ declare function toStrategyParameters({ maxBinId, minBinId, strategyType, single
|
|
|
6342
6275
|
maxBinId: number;
|
|
6343
6276
|
strategyType: {
|
|
6344
6277
|
bidAskBalanced: {};
|
|
6345
|
-
spotOneSide?: undefined;
|
|
6346
|
-
curveOneSide?: undefined;
|
|
6347
|
-
bidAskOneSide?: undefined;
|
|
6348
6278
|
spotBalanced?: undefined;
|
|
6349
6279
|
curveBalanced?: undefined;
|
|
6350
6280
|
spotImBalanced?: undefined;
|
|
@@ -6357,9 +6287,6 @@ declare function toStrategyParameters({ maxBinId, minBinId, strategyType, single
|
|
|
6357
6287
|
maxBinId: number;
|
|
6358
6288
|
strategyType: {
|
|
6359
6289
|
spotImBalanced: {};
|
|
6360
|
-
spotOneSide?: undefined;
|
|
6361
|
-
curveOneSide?: undefined;
|
|
6362
|
-
bidAskOneSide?: undefined;
|
|
6363
6290
|
spotBalanced?: undefined;
|
|
6364
6291
|
curveBalanced?: undefined;
|
|
6365
6292
|
bidAskBalanced?: undefined;
|
|
@@ -6372,9 +6299,6 @@ declare function toStrategyParameters({ maxBinId, minBinId, strategyType, single
|
|
|
6372
6299
|
maxBinId: number;
|
|
6373
6300
|
strategyType: {
|
|
6374
6301
|
curveImBalanced: {};
|
|
6375
|
-
spotOneSide?: undefined;
|
|
6376
|
-
curveOneSide?: undefined;
|
|
6377
|
-
bidAskOneSide?: undefined;
|
|
6378
6302
|
spotBalanced?: undefined;
|
|
6379
6303
|
curveBalanced?: undefined;
|
|
6380
6304
|
bidAskBalanced?: undefined;
|
|
@@ -6387,9 +6311,6 @@ declare function toStrategyParameters({ maxBinId, minBinId, strategyType, single
|
|
|
6387
6311
|
maxBinId: number;
|
|
6388
6312
|
strategyType: {
|
|
6389
6313
|
bidAskImBalanced: {};
|
|
6390
|
-
spotOneSide?: undefined;
|
|
6391
|
-
curveOneSide?: undefined;
|
|
6392
|
-
bidAskOneSide?: undefined;
|
|
6393
6314
|
spotBalanced?: undefined;
|
|
6394
6315
|
curveBalanced?: undefined;
|
|
6395
6316
|
bidAskBalanced?: undefined;
|
|
@@ -6407,7 +6328,6 @@ declare function toStrategyParameters({ maxBinId, minBinId, strategyType, single
|
|
|
6407
6328
|
*/
|
|
6408
6329
|
declare function getTokensMintFromPoolAddress(connection: Connection, poolAddress: string, opt?: {
|
|
6409
6330
|
cluster?: Cluster;
|
|
6410
|
-
programId?: PublicKey;
|
|
6411
6331
|
}): Promise<{
|
|
6412
6332
|
tokenXMint: PublicKey;
|
|
6413
6333
|
tokenYMint: PublicKey;
|
|
@@ -6559,4 +6479,4 @@ declare const MAX_BIN_PER_TX = 69;
|
|
|
6559
6479
|
declare const MAX_ACTIVE_BIN_SLIPPAGE = 3;
|
|
6560
6480
|
declare const ILM_BASE: PublicKey;
|
|
6561
6481
|
|
|
6562
|
-
export { ADMIN, ActivationType, BASIS_POINT_MAX, BIN_ARRAY_BITMAP_SIZE, BIN_ARRAY_FEE, Bin, BinAndAmount, BinArray, BinArrayAccount, BinArrayBitmapExtension, BinArrayBitmapExtensionAccount, BinLiquidity, BinLiquidityDistribution, BinLiquidityReduction, BitmapType, ClmmProgram, Clock, ClockLayout, CompressedBinDepositAmount, CompressedBinDepositAmounts, DLMMError, DlmmSdkError, EXTENSION_BINARRAY_BITMAP_SIZE, EmissionRate, FEE_PRECISION, FeeInfo, GetOrCreateATAResponse, IAccountsCache, IDL, ILM_BASE, InitCustomizablePermissionlessPairIx, InitPermissionPairIx, LBCLMM_PROGRAM_IDS, LMRewards, LbClmm, LbPair, LbPairAccount, LbPosition, LiquidityOneSideParameter, LiquidityParameter, LiquidityParameterByStrategy, LiquidityParameterByStrategyOneSide, LiquidityParameterByWeight, MAX_ACTIVE_BIN_SLIPPAGE, MAX_BIN_ARRAY_SIZE, MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX, MAX_BIN_PER_POSITION, MAX_BIN_PER_TX, MAX_CLAIM_ALL_ALLOWED, MAX_FEE_RATE, Network, POSITION_FEE, PRECISION, PairStatus, PairType, Position, PositionBinData, PositionData, PositionInfo, PositionV2, PositionVersion, ProgramStrategyParameter, ProgramStrategyType, SCALE, SCALE_OFFSET, SIMULATION_USER, SeedLiquidityResponse, Strategy, StrategyParameters, StrategyType, SwapExactOutParams, SwapFee, SwapParams, SwapQuote, SwapQuoteExactOut, SwapWithPriceImpactParams, TInitializePositionAndAddLiquidityParams, TInitializePositionAndAddLiquidityParamsByStrategy, TQuoteCreatePositionParams, TokenReserve, autoFillXByStrategy, autoFillXByWeight, autoFillYByStrategy, autoFillYByWeight, binIdToBinArrayIndex, calculateBidAskDistribution, calculateNormalDistribution, calculateSpotDistribution, chunkedFetchMultipleBinArrayBitmapExtensionAccount, chunkedFetchMultiplePoolAccount, chunkedGetMultipleAccountInfos, chunks, computeFee, computeFeeFromAmount, computeProtocolFee, DLMM as default, deriveBinArray, deriveBinArrayBitmapExtension, deriveCustomizablePermissionlessLbPair, deriveLbPair, deriveLbPair2, deriveOracle, derivePermissionLbPair, derivePosition, derivePresetParameter, derivePresetParameter2, deriveReserve, enumerateBins, findNextBinArrayIndexWithLiquidity, findNextBinArrayWithLiquidity, fromWeightDistributionToAmount, fromWeightDistributionToAmountOneSide, getBaseFee, getBinArrayLowerUpperBinId, getBinArraysRequiredByPositionRange, getBinFromBinArray, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getOrCreateATAInstruction, getOutAmount, getPriceOfBinByBinId, getTokenBalance, getTokenDecimals, getTokensMintFromPoolAddress, getTotalFee, getVariableFee, isBinIdWithinBinArray, isOverflowDefaultBinArrayBitmap, parseLogs, range, sParameters, swapExactInQuoteAtBin, swapExactOutQuoteAtBin, toAmountAskSide, toAmountBidSide, toAmountBothSide, toAmountsBothSideByStrategy,
|
|
6482
|
+
export { ADMIN, ActivationType, BASIS_POINT_MAX, BIN_ARRAY_BITMAP_SIZE, BIN_ARRAY_FEE, Bin, BinAndAmount, BinArray, BinArrayAccount, BinArrayBitmapExtension, BinArrayBitmapExtensionAccount, BinLiquidity, BinLiquidityDistribution, BinLiquidityReduction, BitmapType, ClmmProgram, Clock, ClockLayout, CompressedBinDepositAmount, CompressedBinDepositAmounts, DLMMError, DlmmSdkError, EXTENSION_BINARRAY_BITMAP_SIZE, EmissionRate, FEE_PRECISION, FeeInfo, GetOrCreateATAResponse, IAccountsCache, IDL, ILM_BASE, InitCustomizablePermissionlessPairIx, InitPermissionPairIx, LBCLMM_PROGRAM_IDS, LMRewards, LbClmm, LbPair, LbPairAccount, LbPosition, LiquidityOneSideParameter, LiquidityParameter, LiquidityParameterByStrategy, LiquidityParameterByStrategyOneSide, LiquidityParameterByWeight, MAX_ACTIVE_BIN_SLIPPAGE, MAX_BIN_ARRAY_SIZE, MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX, MAX_BIN_PER_POSITION, MAX_BIN_PER_TX, MAX_CLAIM_ALL_ALLOWED, MAX_FEE_RATE, Network, POSITION_FEE, PRECISION, PairStatus, PairType, Position, PositionBinData, PositionData, PositionInfo, PositionV2, PositionVersion, ProgramStrategyParameter, ProgramStrategyType, SCALE, SCALE_OFFSET, SIMULATION_USER, SeedLiquidityResponse, Strategy, StrategyParameters, StrategyType, SwapExactOutParams, SwapFee, SwapParams, SwapQuote, SwapQuoteExactOut, SwapWithPriceImpactParams, TInitializePositionAndAddLiquidityParams, TInitializePositionAndAddLiquidityParamsByStrategy, TQuoteCreatePositionParams, TokenReserve, autoFillXByStrategy, autoFillXByWeight, autoFillYByStrategy, autoFillYByWeight, binIdToBinArrayIndex, calculateBidAskDistribution, calculateNormalDistribution, calculateSpotDistribution, chunkedFetchMultipleBinArrayBitmapExtensionAccount, chunkedFetchMultiplePoolAccount, chunkedGetMultipleAccountInfos, chunks, computeFee, computeFeeFromAmount, computeProtocolFee, DLMM as default, deriveBinArray, deriveBinArrayBitmapExtension, deriveCustomizablePermissionlessLbPair, deriveLbPair, deriveLbPair2, deriveOracle, derivePermissionLbPair, derivePosition, derivePresetParameter, derivePresetParameter2, deriveReserve, enumerateBins, findNextBinArrayIndexWithLiquidity, findNextBinArrayWithLiquidity, fromWeightDistributionToAmount, fromWeightDistributionToAmountOneSide, getBaseFee, getBinArrayLowerUpperBinId, getBinArraysRequiredByPositionRange, getBinFromBinArray, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getOrCreateATAInstruction, getOutAmount, getPriceOfBinByBinId, getTokenBalance, getTokenDecimals, getTokensMintFromPoolAddress, getTotalFee, getVariableFee, isBinIdWithinBinArray, isOverflowDefaultBinArrayBitmap, parseLogs, range, sParameters, swapExactInQuoteAtBin, swapExactOutQuoteAtBin, toAmountAskSide, toAmountBidSide, toAmountBothSide, toAmountsBothSideByStrategy, toStrategyParameters, toWeightDistribution, unwrapSOLInstruction, vParameters, wrapSOLInstruction };
|
package/dist/index.js
CHANGED
|
@@ -6484,9 +6484,6 @@ var PairType = /* @__PURE__ */ ((PairType2) => {
|
|
|
6484
6484
|
return PairType2;
|
|
6485
6485
|
})(PairType || {});
|
|
6486
6486
|
var Strategy = {
|
|
6487
|
-
SpotOneSide: { spotOneSide: {} },
|
|
6488
|
-
CurveOneSide: { curveOneSide: {} },
|
|
6489
|
-
BidAskOneSide: { bidAskOneSide: {} },
|
|
6490
6487
|
SpotBalanced: { spotBalanced: {} },
|
|
6491
6488
|
CurveBalanced: { curveBalanced: {} },
|
|
6492
6489
|
BidAskBalanced: { bidAskBalanced: {} },
|
|
@@ -6495,15 +6492,12 @@ var Strategy = {
|
|
|
6495
6492
|
BidAskImBalanced: { bidAskImBalanced: {} }
|
|
6496
6493
|
};
|
|
6497
6494
|
var StrategyType = /* @__PURE__ */ ((StrategyType2) => {
|
|
6498
|
-
StrategyType2[StrategyType2["
|
|
6499
|
-
StrategyType2[StrategyType2["
|
|
6500
|
-
StrategyType2[StrategyType2["
|
|
6501
|
-
StrategyType2[StrategyType2["
|
|
6502
|
-
StrategyType2[StrategyType2["
|
|
6503
|
-
StrategyType2[StrategyType2["
|
|
6504
|
-
StrategyType2[StrategyType2["SpotBalanced"] = 6] = "SpotBalanced";
|
|
6505
|
-
StrategyType2[StrategyType2["CurveBalanced"] = 7] = "CurveBalanced";
|
|
6506
|
-
StrategyType2[StrategyType2["BidAskBalanced"] = 8] = "BidAskBalanced";
|
|
6495
|
+
StrategyType2[StrategyType2["SpotImBalanced"] = 0] = "SpotImBalanced";
|
|
6496
|
+
StrategyType2[StrategyType2["CurveImBalanced"] = 1] = "CurveImBalanced";
|
|
6497
|
+
StrategyType2[StrategyType2["BidAskImBalanced"] = 2] = "BidAskImBalanced";
|
|
6498
|
+
StrategyType2[StrategyType2["SpotBalanced"] = 3] = "SpotBalanced";
|
|
6499
|
+
StrategyType2[StrategyType2["CurveBalanced"] = 4] = "CurveBalanced";
|
|
6500
|
+
StrategyType2[StrategyType2["BidAskBalanced"] = 5] = "BidAskBalanced";
|
|
6507
6501
|
return StrategyType2;
|
|
6508
6502
|
})(StrategyType || {});
|
|
6509
6503
|
var ActivationType = /* @__PURE__ */ ((ActivationType2) => {
|
|
@@ -7055,53 +7049,10 @@ function toWeightBidAsk(minBinId, maxBinId, activeId) {
|
|
|
7055
7049
|
}
|
|
7056
7050
|
return distributions;
|
|
7057
7051
|
}
|
|
7058
|
-
function toAmountsOneSideByStrategy(activeId, binStep, minBinId, maxBinId, amount, strategyType, depositForY) {
|
|
7059
|
-
let weights = [];
|
|
7060
|
-
switch (strategyType) {
|
|
7061
|
-
case 6 /* SpotBalanced */:
|
|
7062
|
-
case 7 /* CurveBalanced */:
|
|
7063
|
-
case 8 /* BidAskBalanced */:
|
|
7064
|
-
case 3 /* SpotImBalanced */:
|
|
7065
|
-
case 4 /* CurveImBalanced */:
|
|
7066
|
-
case 5 /* BidAskImBalanced */: {
|
|
7067
|
-
throw "Invalid Strategy Parameters";
|
|
7068
|
-
}
|
|
7069
|
-
case 0 /* SpotOneSide */: {
|
|
7070
|
-
weights = toWeightSpotBalanced(minBinId, maxBinId);
|
|
7071
|
-
break;
|
|
7072
|
-
}
|
|
7073
|
-
case 1 /* CurveOneSide */: {
|
|
7074
|
-
if (depositForY) {
|
|
7075
|
-
weights = toWeightAscendingOrder(minBinId, maxBinId);
|
|
7076
|
-
} else {
|
|
7077
|
-
weights = toWeightDecendingOrder(minBinId, maxBinId);
|
|
7078
|
-
}
|
|
7079
|
-
break;
|
|
7080
|
-
}
|
|
7081
|
-
case 2 /* BidAskOneSide */: {
|
|
7082
|
-
if (depositForY) {
|
|
7083
|
-
weights = toWeightDecendingOrder(minBinId, maxBinId);
|
|
7084
|
-
} else {
|
|
7085
|
-
weights = toWeightAscendingOrder(minBinId, maxBinId);
|
|
7086
|
-
}
|
|
7087
|
-
break;
|
|
7088
|
-
}
|
|
7089
|
-
}
|
|
7090
|
-
if (depositForY) {
|
|
7091
|
-
return toAmountBidSide(activeId, amount, weights);
|
|
7092
|
-
} else {
|
|
7093
|
-
return toAmountAskSide(activeId, binStep, amount, weights);
|
|
7094
|
-
}
|
|
7095
|
-
}
|
|
7096
7052
|
function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amountX, amountY, amountXInActiveBin, amountYInActiveBin, strategyType) {
|
|
7097
7053
|
const isSingleSideX = amountY.isZero();
|
|
7098
7054
|
switch (strategyType) {
|
|
7099
|
-
case 0 /*
|
|
7100
|
-
case 1 /* CurveOneSide */:
|
|
7101
|
-
case 2 /* BidAskOneSide */: {
|
|
7102
|
-
throw "Invalid Strategy Parameters";
|
|
7103
|
-
}
|
|
7104
|
-
case 3 /* SpotImBalanced */: {
|
|
7055
|
+
case 0 /* SpotImBalanced */: {
|
|
7105
7056
|
if (activeId < minBinId || activeId > maxBinId) {
|
|
7106
7057
|
const weights = toWeightSpotBalanced(minBinId, maxBinId);
|
|
7107
7058
|
return toAmountBothSide(
|
|
@@ -7173,7 +7124,7 @@ function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amou
|
|
|
7173
7124
|
}
|
|
7174
7125
|
return amountsInBin;
|
|
7175
7126
|
}
|
|
7176
|
-
case
|
|
7127
|
+
case 1 /* CurveImBalanced */: {
|
|
7177
7128
|
if (activeId < minBinId) {
|
|
7178
7129
|
let weights = toWeightDecendingOrder(minBinId, maxBinId);
|
|
7179
7130
|
return toAmountBothSide(
|
|
@@ -7257,7 +7208,7 @@ function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amou
|
|
|
7257
7208
|
}
|
|
7258
7209
|
return amountsInBin;
|
|
7259
7210
|
}
|
|
7260
|
-
case
|
|
7211
|
+
case 2 /* BidAskImBalanced */: {
|
|
7261
7212
|
if (activeId < minBinId) {
|
|
7262
7213
|
const weights = toWeightAscendingOrder(minBinId, maxBinId);
|
|
7263
7214
|
return toAmountBothSide(
|
|
@@ -7341,7 +7292,7 @@ function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amou
|
|
|
7341
7292
|
}
|
|
7342
7293
|
return amountsInBin;
|
|
7343
7294
|
}
|
|
7344
|
-
case
|
|
7295
|
+
case 3 /* SpotBalanced */: {
|
|
7345
7296
|
let weights = toWeightSpotBalanced(minBinId, maxBinId);
|
|
7346
7297
|
return toAmountBothSide(
|
|
7347
7298
|
activeId,
|
|
@@ -7353,7 +7304,7 @@ function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amou
|
|
|
7353
7304
|
weights
|
|
7354
7305
|
);
|
|
7355
7306
|
}
|
|
7356
|
-
case
|
|
7307
|
+
case 4 /* CurveBalanced */: {
|
|
7357
7308
|
let weights = toWeightCurve(minBinId, maxBinId, activeId);
|
|
7358
7309
|
return toAmountBothSide(
|
|
7359
7310
|
activeId,
|
|
@@ -7365,7 +7316,7 @@ function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amou
|
|
|
7365
7316
|
weights
|
|
7366
7317
|
);
|
|
7367
7318
|
}
|
|
7368
|
-
case
|
|
7319
|
+
case 5 /* BidAskBalanced */: {
|
|
7369
7320
|
let weights = toWeightBidAsk(minBinId, maxBinId, activeId);
|
|
7370
7321
|
return toAmountBothSide(
|
|
7371
7322
|
activeId,
|
|
@@ -7381,15 +7332,12 @@ function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amou
|
|
|
7381
7332
|
}
|
|
7382
7333
|
function autoFillYByStrategy(activeId, binStep, amountX, amountXInActiveBin, amountYInActiveBin, minBinId, maxBinId, strategyType) {
|
|
7383
7334
|
switch (strategyType) {
|
|
7384
|
-
case 0 /*
|
|
7385
|
-
case 1 /*
|
|
7386
|
-
case 2 /*
|
|
7387
|
-
case 3 /* SpotImBalanced */:
|
|
7388
|
-
case 4 /* CurveImBalanced */:
|
|
7389
|
-
case 5 /* BidAskImBalanced */: {
|
|
7335
|
+
case 0 /* SpotImBalanced */:
|
|
7336
|
+
case 1 /* CurveImBalanced */:
|
|
7337
|
+
case 2 /* BidAskImBalanced */: {
|
|
7390
7338
|
throw "Invalid Strategy Parameters";
|
|
7391
7339
|
}
|
|
7392
|
-
case
|
|
7340
|
+
case 3 /* SpotBalanced */: {
|
|
7393
7341
|
let weights = toWeightSpotBalanced(minBinId, maxBinId);
|
|
7394
7342
|
return autoFillYByWeight(
|
|
7395
7343
|
activeId,
|
|
@@ -7400,7 +7348,7 @@ function autoFillYByStrategy(activeId, binStep, amountX, amountXInActiveBin, amo
|
|
|
7400
7348
|
weights
|
|
7401
7349
|
);
|
|
7402
7350
|
}
|
|
7403
|
-
case
|
|
7351
|
+
case 4 /* CurveBalanced */: {
|
|
7404
7352
|
let weights = toWeightCurve(minBinId, maxBinId, activeId);
|
|
7405
7353
|
return autoFillYByWeight(
|
|
7406
7354
|
activeId,
|
|
@@ -7411,7 +7359,7 @@ function autoFillYByStrategy(activeId, binStep, amountX, amountXInActiveBin, amo
|
|
|
7411
7359
|
weights
|
|
7412
7360
|
);
|
|
7413
7361
|
}
|
|
7414
|
-
case
|
|
7362
|
+
case 5 /* BidAskBalanced */: {
|
|
7415
7363
|
let weights = toWeightBidAsk(minBinId, maxBinId, activeId);
|
|
7416
7364
|
return autoFillYByWeight(
|
|
7417
7365
|
activeId,
|
|
@@ -7426,15 +7374,12 @@ function autoFillYByStrategy(activeId, binStep, amountX, amountXInActiveBin, amo
|
|
|
7426
7374
|
}
|
|
7427
7375
|
function autoFillXByStrategy(activeId, binStep, amountY, amountXInActiveBin, amountYInActiveBin, minBinId, maxBinId, strategyType) {
|
|
7428
7376
|
switch (strategyType) {
|
|
7429
|
-
case 0 /*
|
|
7430
|
-
case 1 /*
|
|
7431
|
-
case 2 /*
|
|
7432
|
-
case 3 /* SpotImBalanced */:
|
|
7433
|
-
case 4 /* CurveImBalanced */:
|
|
7434
|
-
case 5 /* BidAskImBalanced */: {
|
|
7377
|
+
case 0 /* SpotImBalanced */:
|
|
7378
|
+
case 1 /* CurveImBalanced */:
|
|
7379
|
+
case 2 /* BidAskImBalanced */: {
|
|
7435
7380
|
throw "Invalid Strategy Parameters";
|
|
7436
7381
|
}
|
|
7437
|
-
case
|
|
7382
|
+
case 3 /* SpotBalanced */: {
|
|
7438
7383
|
let weights = toWeightSpotBalanced(minBinId, maxBinId);
|
|
7439
7384
|
return autoFillXByWeight(
|
|
7440
7385
|
activeId,
|
|
@@ -7445,7 +7390,7 @@ function autoFillXByStrategy(activeId, binStep, amountY, amountXInActiveBin, amo
|
|
|
7445
7390
|
weights
|
|
7446
7391
|
);
|
|
7447
7392
|
}
|
|
7448
|
-
case
|
|
7393
|
+
case 4 /* CurveBalanced */: {
|
|
7449
7394
|
let weights = toWeightCurve(minBinId, maxBinId, activeId);
|
|
7450
7395
|
return autoFillXByWeight(
|
|
7451
7396
|
activeId,
|
|
@@ -7456,7 +7401,7 @@ function autoFillXByStrategy(activeId, binStep, amountY, amountXInActiveBin, amo
|
|
|
7456
7401
|
weights
|
|
7457
7402
|
);
|
|
7458
7403
|
}
|
|
7459
|
-
case
|
|
7404
|
+
case 5 /* BidAskBalanced */: {
|
|
7460
7405
|
let weights = toWeightBidAsk(minBinId, maxBinId, activeId);
|
|
7461
7406
|
return autoFillXByWeight(
|
|
7462
7407
|
activeId,
|
|
@@ -7477,31 +7422,7 @@ function toStrategyParameters({
|
|
|
7477
7422
|
}) {
|
|
7478
7423
|
const parameters = [singleSidedX ? 1 : 0, ...new Array(63).fill(0)];
|
|
7479
7424
|
switch (strategyType) {
|
|
7480
|
-
case
|
|
7481
|
-
return {
|
|
7482
|
-
minBinId,
|
|
7483
|
-
maxBinId,
|
|
7484
|
-
strategyType: { spotOneSide: {} },
|
|
7485
|
-
parameteres: Buffer.from(parameters).toJSON().data
|
|
7486
|
-
};
|
|
7487
|
-
}
|
|
7488
|
-
case 1 /* CurveOneSide */: {
|
|
7489
|
-
return {
|
|
7490
|
-
minBinId,
|
|
7491
|
-
maxBinId,
|
|
7492
|
-
strategyType: { curveOneSide: {} },
|
|
7493
|
-
parameteres: Buffer.from(parameters).toJSON().data
|
|
7494
|
-
};
|
|
7495
|
-
}
|
|
7496
|
-
case 2 /* BidAskOneSide */: {
|
|
7497
|
-
return {
|
|
7498
|
-
minBinId,
|
|
7499
|
-
maxBinId,
|
|
7500
|
-
strategyType: { bidAskOneSide: {} },
|
|
7501
|
-
parameteres: Buffer.from(parameters).toJSON().data
|
|
7502
|
-
};
|
|
7503
|
-
}
|
|
7504
|
-
case 6 /* SpotBalanced */: {
|
|
7425
|
+
case 3 /* SpotBalanced */: {
|
|
7505
7426
|
return {
|
|
7506
7427
|
minBinId,
|
|
7507
7428
|
maxBinId,
|
|
@@ -7509,7 +7430,7 @@ function toStrategyParameters({
|
|
|
7509
7430
|
parameteres: Buffer.from(parameters).toJSON().data
|
|
7510
7431
|
};
|
|
7511
7432
|
}
|
|
7512
|
-
case
|
|
7433
|
+
case 4 /* CurveBalanced */: {
|
|
7513
7434
|
return {
|
|
7514
7435
|
minBinId,
|
|
7515
7436
|
maxBinId,
|
|
@@ -7517,7 +7438,7 @@ function toStrategyParameters({
|
|
|
7517
7438
|
parameteres: Buffer.from(parameters).toJSON().data
|
|
7518
7439
|
};
|
|
7519
7440
|
}
|
|
7520
|
-
case
|
|
7441
|
+
case 5 /* BidAskBalanced */: {
|
|
7521
7442
|
return {
|
|
7522
7443
|
minBinId,
|
|
7523
7444
|
maxBinId,
|
|
@@ -7525,7 +7446,7 @@ function toStrategyParameters({
|
|
|
7525
7446
|
parameteres: Buffer.from(parameters).toJSON().data
|
|
7526
7447
|
};
|
|
7527
7448
|
}
|
|
7528
|
-
case
|
|
7449
|
+
case 0 /* SpotImBalanced */: {
|
|
7529
7450
|
return {
|
|
7530
7451
|
minBinId,
|
|
7531
7452
|
maxBinId,
|
|
@@ -7533,7 +7454,7 @@ function toStrategyParameters({
|
|
|
7533
7454
|
parameteres: Buffer.from(parameters).toJSON().data
|
|
7534
7455
|
};
|
|
7535
7456
|
}
|
|
7536
|
-
case
|
|
7457
|
+
case 1 /* CurveImBalanced */: {
|
|
7537
7458
|
return {
|
|
7538
7459
|
minBinId,
|
|
7539
7460
|
maxBinId,
|
|
@@ -7541,7 +7462,7 @@ function toStrategyParameters({
|
|
|
7541
7462
|
parameteres: Buffer.from(parameters).toJSON().data
|
|
7542
7463
|
};
|
|
7543
7464
|
}
|
|
7544
|
-
case
|
|
7465
|
+
case 2 /* BidAskImBalanced */: {
|
|
7545
7466
|
return {
|
|
7546
7467
|
minBinId,
|
|
7547
7468
|
maxBinId,
|
|
@@ -12120,6 +12041,5 @@ var src_default = DLMM;
|
|
|
12120
12041
|
|
|
12121
12042
|
|
|
12122
12043
|
|
|
12123
|
-
|
|
12124
|
-
exports.ADMIN = ADMIN; exports.ActivationType = ActivationType; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.BIN_ARRAY_BITMAP_SIZE = BIN_ARRAY_BITMAP_SIZE; exports.BIN_ARRAY_FEE = BIN_ARRAY_FEE; exports.BinLiquidity = BinLiquidity; exports.BitmapType = BitmapType; exports.ClockLayout = ClockLayout; exports.DLMMError = DLMMError; exports.DlmmSdkError = DlmmSdkError; exports.EXTENSION_BINARRAY_BITMAP_SIZE = EXTENSION_BINARRAY_BITMAP_SIZE; exports.FEE_PRECISION = FEE_PRECISION; exports.IDL = IDL; exports.ILM_BASE = ILM_BASE; exports.LBCLMM_PROGRAM_IDS = LBCLMM_PROGRAM_IDS; exports.MAX_ACTIVE_BIN_SLIPPAGE = MAX_ACTIVE_BIN_SLIPPAGE; exports.MAX_BIN_ARRAY_SIZE = MAX_BIN_ARRAY_SIZE; exports.MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX = MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX; exports.MAX_BIN_PER_POSITION = MAX_BIN_PER_POSITION; exports.MAX_BIN_PER_TX = MAX_BIN_PER_TX; exports.MAX_CLAIM_ALL_ALLOWED = MAX_CLAIM_ALL_ALLOWED; exports.MAX_FEE_RATE = MAX_FEE_RATE; exports.Network = Network; exports.POSITION_FEE = POSITION_FEE; exports.PRECISION = PRECISION; exports.PairStatus = PairStatus; exports.PairType = PairType; exports.PositionVersion = PositionVersion; exports.SCALE = SCALE; exports.SCALE_OFFSET = SCALE_OFFSET; exports.SIMULATION_USER = SIMULATION_USER; exports.Strategy = Strategy; exports.StrategyType = StrategyType; exports.autoFillXByStrategy = autoFillXByStrategy; exports.autoFillXByWeight = autoFillXByWeight; exports.autoFillYByStrategy = autoFillYByStrategy; exports.autoFillYByWeight = autoFillYByWeight; exports.binIdToBinArrayIndex = binIdToBinArrayIndex; exports.calculateBidAskDistribution = calculateBidAskDistribution; exports.calculateNormalDistribution = calculateNormalDistribution; exports.calculateSpotDistribution = calculateSpotDistribution; exports.chunkedFetchMultipleBinArrayBitmapExtensionAccount = chunkedFetchMultipleBinArrayBitmapExtensionAccount; exports.chunkedFetchMultiplePoolAccount = chunkedFetchMultiplePoolAccount; exports.chunkedGetMultipleAccountInfos = chunkedGetMultipleAccountInfos; exports.chunks = chunks; exports.computeFee = computeFee; exports.computeFeeFromAmount = computeFeeFromAmount; exports.computeProtocolFee = computeProtocolFee; exports.default = src_default; exports.deriveBinArray = deriveBinArray; exports.deriveBinArrayBitmapExtension = deriveBinArrayBitmapExtension; exports.deriveCustomizablePermissionlessLbPair = deriveCustomizablePermissionlessLbPair; exports.deriveLbPair = deriveLbPair; exports.deriveLbPair2 = deriveLbPair2; exports.deriveOracle = deriveOracle; exports.derivePermissionLbPair = derivePermissionLbPair; exports.derivePosition = derivePosition; exports.derivePresetParameter = derivePresetParameter; exports.derivePresetParameter2 = derivePresetParameter2; exports.deriveReserve = deriveReserve; exports.enumerateBins = enumerateBins; exports.findNextBinArrayIndexWithLiquidity = findNextBinArrayIndexWithLiquidity; exports.findNextBinArrayWithLiquidity = findNextBinArrayWithLiquidity; exports.fromWeightDistributionToAmount = fromWeightDistributionToAmount; exports.fromWeightDistributionToAmountOneSide = fromWeightDistributionToAmountOneSide; exports.getBaseFee = getBaseFee; exports.getBinArrayLowerUpperBinId = getBinArrayLowerUpperBinId; exports.getBinArraysRequiredByPositionRange = getBinArraysRequiredByPositionRange; exports.getBinFromBinArray = getBinFromBinArray; exports.getEstimatedComputeUnitIxWithBuffer = getEstimatedComputeUnitIxWithBuffer; exports.getEstimatedComputeUnitUsageWithBuffer = getEstimatedComputeUnitUsageWithBuffer; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getOutAmount = getOutAmount; exports.getPriceOfBinByBinId = getPriceOfBinByBinId; exports.getTokenBalance = getTokenBalance; exports.getTokenDecimals = getTokenDecimals; exports.getTokensMintFromPoolAddress = getTokensMintFromPoolAddress; exports.getTotalFee = getTotalFee; exports.getVariableFee = getVariableFee; exports.isBinIdWithinBinArray = isBinIdWithinBinArray; exports.isOverflowDefaultBinArrayBitmap = isOverflowDefaultBinArrayBitmap; exports.parseLogs = parseLogs; exports.range = range; exports.swapExactInQuoteAtBin = swapExactInQuoteAtBin; exports.swapExactOutQuoteAtBin = swapExactOutQuoteAtBin; exports.toAmountAskSide = toAmountAskSide; exports.toAmountBidSide = toAmountBidSide; exports.toAmountBothSide = toAmountBothSide; exports.toAmountsBothSideByStrategy = toAmountsBothSideByStrategy; exports.toAmountsOneSideByStrategy = toAmountsOneSideByStrategy; exports.toStrategyParameters = toStrategyParameters; exports.toWeightDistribution = toWeightDistribution; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.wrapSOLInstruction = wrapSOLInstruction;
|
|
12044
|
+
exports.ADMIN = ADMIN; exports.ActivationType = ActivationType; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.BIN_ARRAY_BITMAP_SIZE = BIN_ARRAY_BITMAP_SIZE; exports.BIN_ARRAY_FEE = BIN_ARRAY_FEE; exports.BinLiquidity = BinLiquidity; exports.BitmapType = BitmapType; exports.ClockLayout = ClockLayout; exports.DLMMError = DLMMError; exports.DlmmSdkError = DlmmSdkError; exports.EXTENSION_BINARRAY_BITMAP_SIZE = EXTENSION_BINARRAY_BITMAP_SIZE; exports.FEE_PRECISION = FEE_PRECISION; exports.IDL = IDL; exports.ILM_BASE = ILM_BASE; exports.LBCLMM_PROGRAM_IDS = LBCLMM_PROGRAM_IDS; exports.MAX_ACTIVE_BIN_SLIPPAGE = MAX_ACTIVE_BIN_SLIPPAGE; exports.MAX_BIN_ARRAY_SIZE = MAX_BIN_ARRAY_SIZE; exports.MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX = MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX; exports.MAX_BIN_PER_POSITION = MAX_BIN_PER_POSITION; exports.MAX_BIN_PER_TX = MAX_BIN_PER_TX; exports.MAX_CLAIM_ALL_ALLOWED = MAX_CLAIM_ALL_ALLOWED; exports.MAX_FEE_RATE = MAX_FEE_RATE; exports.Network = Network; exports.POSITION_FEE = POSITION_FEE; exports.PRECISION = PRECISION; exports.PairStatus = PairStatus; exports.PairType = PairType; exports.PositionVersion = PositionVersion; exports.SCALE = SCALE; exports.SCALE_OFFSET = SCALE_OFFSET; exports.SIMULATION_USER = SIMULATION_USER; exports.Strategy = Strategy; exports.StrategyType = StrategyType; exports.autoFillXByStrategy = autoFillXByStrategy; exports.autoFillXByWeight = autoFillXByWeight; exports.autoFillYByStrategy = autoFillYByStrategy; exports.autoFillYByWeight = autoFillYByWeight; exports.binIdToBinArrayIndex = binIdToBinArrayIndex; exports.calculateBidAskDistribution = calculateBidAskDistribution; exports.calculateNormalDistribution = calculateNormalDistribution; exports.calculateSpotDistribution = calculateSpotDistribution; exports.chunkedFetchMultipleBinArrayBitmapExtensionAccount = chunkedFetchMultipleBinArrayBitmapExtensionAccount; exports.chunkedFetchMultiplePoolAccount = chunkedFetchMultiplePoolAccount; exports.chunkedGetMultipleAccountInfos = chunkedGetMultipleAccountInfos; exports.chunks = chunks; exports.computeFee = computeFee; exports.computeFeeFromAmount = computeFeeFromAmount; exports.computeProtocolFee = computeProtocolFee; exports.default = src_default; exports.deriveBinArray = deriveBinArray; exports.deriveBinArrayBitmapExtension = deriveBinArrayBitmapExtension; exports.deriveCustomizablePermissionlessLbPair = deriveCustomizablePermissionlessLbPair; exports.deriveLbPair = deriveLbPair; exports.deriveLbPair2 = deriveLbPair2; exports.deriveOracle = deriveOracle; exports.derivePermissionLbPair = derivePermissionLbPair; exports.derivePosition = derivePosition; exports.derivePresetParameter = derivePresetParameter; exports.derivePresetParameter2 = derivePresetParameter2; exports.deriveReserve = deriveReserve; exports.enumerateBins = enumerateBins; exports.findNextBinArrayIndexWithLiquidity = findNextBinArrayIndexWithLiquidity; exports.findNextBinArrayWithLiquidity = findNextBinArrayWithLiquidity; exports.fromWeightDistributionToAmount = fromWeightDistributionToAmount; exports.fromWeightDistributionToAmountOneSide = fromWeightDistributionToAmountOneSide; exports.getBaseFee = getBaseFee; exports.getBinArrayLowerUpperBinId = getBinArrayLowerUpperBinId; exports.getBinArraysRequiredByPositionRange = getBinArraysRequiredByPositionRange; exports.getBinFromBinArray = getBinFromBinArray; exports.getEstimatedComputeUnitIxWithBuffer = getEstimatedComputeUnitIxWithBuffer; exports.getEstimatedComputeUnitUsageWithBuffer = getEstimatedComputeUnitUsageWithBuffer; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getOutAmount = getOutAmount; exports.getPriceOfBinByBinId = getPriceOfBinByBinId; exports.getTokenBalance = getTokenBalance; exports.getTokenDecimals = getTokenDecimals; exports.getTokensMintFromPoolAddress = getTokensMintFromPoolAddress; exports.getTotalFee = getTotalFee; exports.getVariableFee = getVariableFee; exports.isBinIdWithinBinArray = isBinIdWithinBinArray; exports.isOverflowDefaultBinArrayBitmap = isOverflowDefaultBinArrayBitmap; exports.parseLogs = parseLogs; exports.range = range; exports.swapExactInQuoteAtBin = swapExactInQuoteAtBin; exports.swapExactOutQuoteAtBin = swapExactOutQuoteAtBin; exports.toAmountAskSide = toAmountAskSide; exports.toAmountBidSide = toAmountBidSide; exports.toAmountBothSide = toAmountBothSide; exports.toAmountsBothSideByStrategy = toAmountsBothSideByStrategy; exports.toStrategyParameters = toStrategyParameters; exports.toWeightDistribution = toWeightDistribution; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.wrapSOLInstruction = wrapSOLInstruction;
|
|
12125
12045
|
//# sourceMappingURL=index.js.map
|