@meteora-ag/dlmm 1.3.9-rc.1 → 1.3.9
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 +64 -144
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -111
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
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,
|
|
@@ -7563,7 +7484,7 @@ async function getTokensMintFromPoolAddress(connection, poolAddress, opt) {
|
|
|
7563
7484
|
);
|
|
7564
7485
|
const program = new Program2(
|
|
7565
7486
|
IDL,
|
|
7566
|
-
|
|
7487
|
+
LBCLMM_PROGRAM_IDS[opt?.cluster ?? "mainnet-beta"],
|
|
7567
7488
|
provider
|
|
7568
7489
|
);
|
|
7569
7490
|
const poolAccount = await program.account.lbPair.fetchNullable(
|
|
@@ -12116,7 +12037,6 @@ export {
|
|
|
12116
12037
|
toAmountBidSide,
|
|
12117
12038
|
toAmountBothSide,
|
|
12118
12039
|
toAmountsBothSideByStrategy,
|
|
12119
|
-
toAmountsOneSideByStrategy,
|
|
12120
12040
|
toStrategyParameters,
|
|
12121
12041
|
toWeightDistribution,
|
|
12122
12042
|
unwrapSOLInstruction,
|