@meteora-ag/dlmm 1.0.46 → 1.0.47-rc.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 +2 -1
- package/dist/index.js +100 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +100 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4739,6 +4739,7 @@ interface StrategyParameters {
|
|
|
4739
4739
|
maxBinId: number;
|
|
4740
4740
|
minBinId: number;
|
|
4741
4741
|
strategyType: StrategyType;
|
|
4742
|
+
singleSided?: boolean;
|
|
4742
4743
|
}
|
|
4743
4744
|
interface TQuoteCreatePositionParams {
|
|
4744
4745
|
strategy: StrategyParameters;
|
|
@@ -5463,7 +5464,7 @@ declare function toAmountsBothSideByStrategy(activeId: number, binStep: number,
|
|
|
5463
5464
|
}[];
|
|
5464
5465
|
declare function autoFillYByStrategy(activeId: number, binStep: number, amountX: BN, amountXInActiveBin: BN, amountYInActiveBin: BN, minBinId: number, maxBinId: number, strategyType: StrategyType): BN;
|
|
5465
5466
|
declare function autoFillXByStrategy(activeId: number, binStep: number, amountY: BN, amountXInActiveBin: BN, amountYInActiveBin: BN, minBinId: number, maxBinId: number, strategyType: StrategyType): BN;
|
|
5466
|
-
declare function toStrategyParameters(
|
|
5467
|
+
declare function toStrategyParameters({ maxBinId, minBinId, strategyType, singleSided, }: StrategyParameters): {
|
|
5467
5468
|
minBinId: number;
|
|
5468
5469
|
maxBinId: number;
|
|
5469
5470
|
strategyType: {
|
package/dist/index.js
CHANGED
|
@@ -6302,7 +6302,15 @@ function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amou
|
|
|
6302
6302
|
case 3 /* SpotImBalanced */: {
|
|
6303
6303
|
if (activeId < minBinId || activeId > maxBinId) {
|
|
6304
6304
|
let weights = toWeightSpotBalanced(minBinId, maxBinId);
|
|
6305
|
-
return toAmountBothSide(
|
|
6305
|
+
return toAmountBothSide(
|
|
6306
|
+
activeId,
|
|
6307
|
+
binStep,
|
|
6308
|
+
amountX,
|
|
6309
|
+
amountY,
|
|
6310
|
+
amountXInActiveBin,
|
|
6311
|
+
amountYInActiveBin,
|
|
6312
|
+
weights
|
|
6313
|
+
);
|
|
6306
6314
|
}
|
|
6307
6315
|
let amountsInBin = [];
|
|
6308
6316
|
if (minBinId <= activeId) {
|
|
@@ -6431,15 +6439,39 @@ function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amou
|
|
|
6431
6439
|
}
|
|
6432
6440
|
case 6 /* SpotBalanced */: {
|
|
6433
6441
|
let weights = toWeightSpotBalanced(minBinId, maxBinId);
|
|
6434
|
-
return toAmountBothSide(
|
|
6442
|
+
return toAmountBothSide(
|
|
6443
|
+
activeId,
|
|
6444
|
+
binStep,
|
|
6445
|
+
amountX,
|
|
6446
|
+
amountY,
|
|
6447
|
+
amountXInActiveBin,
|
|
6448
|
+
amountYInActiveBin,
|
|
6449
|
+
weights
|
|
6450
|
+
);
|
|
6435
6451
|
}
|
|
6436
6452
|
case 7 /* CurveBalanced */: {
|
|
6437
6453
|
let weights = toWeightCurve(minBinId, maxBinId, activeId);
|
|
6438
|
-
return toAmountBothSide(
|
|
6454
|
+
return toAmountBothSide(
|
|
6455
|
+
activeId,
|
|
6456
|
+
binStep,
|
|
6457
|
+
amountX,
|
|
6458
|
+
amountY,
|
|
6459
|
+
amountXInActiveBin,
|
|
6460
|
+
amountYInActiveBin,
|
|
6461
|
+
weights
|
|
6462
|
+
);
|
|
6439
6463
|
}
|
|
6440
6464
|
case 8 /* BidAskBalanced */: {
|
|
6441
6465
|
let weights = toWeightBidAsk(minBinId, maxBinId, activeId);
|
|
6442
|
-
return toAmountBothSide(
|
|
6466
|
+
return toAmountBothSide(
|
|
6467
|
+
activeId,
|
|
6468
|
+
binStep,
|
|
6469
|
+
amountX,
|
|
6470
|
+
amountY,
|
|
6471
|
+
amountXInActiveBin,
|
|
6472
|
+
amountYInActiveBin,
|
|
6473
|
+
weights
|
|
6474
|
+
);
|
|
6443
6475
|
}
|
|
6444
6476
|
}
|
|
6445
6477
|
}
|
|
@@ -6455,15 +6487,36 @@ function autoFillYByStrategy(activeId, binStep, amountX, amountXInActiveBin, amo
|
|
|
6455
6487
|
}
|
|
6456
6488
|
case 6 /* SpotBalanced */: {
|
|
6457
6489
|
let weights = toWeightSpotBalanced(minBinId, maxBinId);
|
|
6458
|
-
return autoFillYByWeight(
|
|
6490
|
+
return autoFillYByWeight(
|
|
6491
|
+
activeId,
|
|
6492
|
+
binStep,
|
|
6493
|
+
amountX,
|
|
6494
|
+
amountXInActiveBin,
|
|
6495
|
+
amountYInActiveBin,
|
|
6496
|
+
weights
|
|
6497
|
+
);
|
|
6459
6498
|
}
|
|
6460
6499
|
case 7 /* CurveBalanced */: {
|
|
6461
6500
|
let weights = toWeightCurve(minBinId, maxBinId, activeId);
|
|
6462
|
-
return autoFillYByWeight(
|
|
6501
|
+
return autoFillYByWeight(
|
|
6502
|
+
activeId,
|
|
6503
|
+
binStep,
|
|
6504
|
+
amountX,
|
|
6505
|
+
amountXInActiveBin,
|
|
6506
|
+
amountYInActiveBin,
|
|
6507
|
+
weights
|
|
6508
|
+
);
|
|
6463
6509
|
}
|
|
6464
6510
|
case 8 /* BidAskBalanced */: {
|
|
6465
6511
|
let weights = toWeightBidAsk(minBinId, maxBinId, activeId);
|
|
6466
|
-
return autoFillYByWeight(
|
|
6512
|
+
return autoFillYByWeight(
|
|
6513
|
+
activeId,
|
|
6514
|
+
binStep,
|
|
6515
|
+
amountX,
|
|
6516
|
+
amountXInActiveBin,
|
|
6517
|
+
amountYInActiveBin,
|
|
6518
|
+
weights
|
|
6519
|
+
);
|
|
6467
6520
|
}
|
|
6468
6521
|
}
|
|
6469
6522
|
}
|
|
@@ -6479,31 +6532,53 @@ function autoFillXByStrategy(activeId, binStep, amountY, amountXInActiveBin, amo
|
|
|
6479
6532
|
}
|
|
6480
6533
|
case 6 /* SpotBalanced */: {
|
|
6481
6534
|
let weights = toWeightSpotBalanced(minBinId, maxBinId);
|
|
6482
|
-
return autoFillXByWeight(
|
|
6535
|
+
return autoFillXByWeight(
|
|
6536
|
+
activeId,
|
|
6537
|
+
binStep,
|
|
6538
|
+
amountY,
|
|
6539
|
+
amountXInActiveBin,
|
|
6540
|
+
amountYInActiveBin,
|
|
6541
|
+
weights
|
|
6542
|
+
);
|
|
6483
6543
|
}
|
|
6484
6544
|
case 7 /* CurveBalanced */: {
|
|
6485
6545
|
let weights = toWeightCurve(minBinId, maxBinId, activeId);
|
|
6486
|
-
return autoFillXByWeight(
|
|
6546
|
+
return autoFillXByWeight(
|
|
6547
|
+
activeId,
|
|
6548
|
+
binStep,
|
|
6549
|
+
amountY,
|
|
6550
|
+
amountXInActiveBin,
|
|
6551
|
+
amountYInActiveBin,
|
|
6552
|
+
weights
|
|
6553
|
+
);
|
|
6487
6554
|
}
|
|
6488
6555
|
case 8 /* BidAskBalanced */: {
|
|
6489
6556
|
let weights = toWeightBidAsk(minBinId, maxBinId, activeId);
|
|
6490
|
-
return autoFillXByWeight(
|
|
6557
|
+
return autoFillXByWeight(
|
|
6558
|
+
activeId,
|
|
6559
|
+
binStep,
|
|
6560
|
+
amountY,
|
|
6561
|
+
amountXInActiveBin,
|
|
6562
|
+
amountYInActiveBin,
|
|
6563
|
+
weights
|
|
6564
|
+
);
|
|
6491
6565
|
}
|
|
6492
6566
|
}
|
|
6493
6567
|
}
|
|
6494
|
-
function toStrategyParameters(
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6568
|
+
function toStrategyParameters({
|
|
6569
|
+
maxBinId,
|
|
6570
|
+
minBinId,
|
|
6571
|
+
strategyType,
|
|
6572
|
+
singleSided
|
|
6573
|
+
}) {
|
|
6574
|
+
const parameters = [singleSided ? 1 : 0, ...new Array(63).fill(0)];
|
|
6500
6575
|
switch (strategyType) {
|
|
6501
6576
|
case 0 /* SpotOneSide */: {
|
|
6502
6577
|
return {
|
|
6503
6578
|
minBinId,
|
|
6504
6579
|
maxBinId,
|
|
6505
6580
|
strategyType: { spotOneSide: {} },
|
|
6506
|
-
parameteres: Buffer.from(
|
|
6581
|
+
parameteres: Buffer.from(parameters).toJSON().data
|
|
6507
6582
|
};
|
|
6508
6583
|
}
|
|
6509
6584
|
case 1 /* CurveOneSide */: {
|
|
@@ -6511,7 +6586,7 @@ function toStrategyParameters(strategyParameters) {
|
|
|
6511
6586
|
minBinId,
|
|
6512
6587
|
maxBinId,
|
|
6513
6588
|
strategyType: { curveOneSide: {} },
|
|
6514
|
-
parameteres: Buffer.from(
|
|
6589
|
+
parameteres: Buffer.from(parameters).toJSON().data
|
|
6515
6590
|
};
|
|
6516
6591
|
}
|
|
6517
6592
|
case 2 /* BidAskOneSide */: {
|
|
@@ -6519,7 +6594,7 @@ function toStrategyParameters(strategyParameters) {
|
|
|
6519
6594
|
minBinId,
|
|
6520
6595
|
maxBinId,
|
|
6521
6596
|
strategyType: { bidAskOneSide: {} },
|
|
6522
|
-
parameteres: Buffer.from(
|
|
6597
|
+
parameteres: Buffer.from(parameters).toJSON().data
|
|
6523
6598
|
};
|
|
6524
6599
|
}
|
|
6525
6600
|
case 6 /* SpotBalanced */: {
|
|
@@ -6527,7 +6602,7 @@ function toStrategyParameters(strategyParameters) {
|
|
|
6527
6602
|
minBinId,
|
|
6528
6603
|
maxBinId,
|
|
6529
6604
|
strategyType: { spotBalanced: {} },
|
|
6530
|
-
parameteres: Buffer.from(
|
|
6605
|
+
parameteres: Buffer.from(parameters).toJSON().data
|
|
6531
6606
|
};
|
|
6532
6607
|
}
|
|
6533
6608
|
case 7 /* CurveBalanced */: {
|
|
@@ -6535,7 +6610,7 @@ function toStrategyParameters(strategyParameters) {
|
|
|
6535
6610
|
minBinId,
|
|
6536
6611
|
maxBinId,
|
|
6537
6612
|
strategyType: { curveBalanced: {} },
|
|
6538
|
-
parameteres: Buffer.from(
|
|
6613
|
+
parameteres: Buffer.from(parameters).toJSON().data
|
|
6539
6614
|
};
|
|
6540
6615
|
}
|
|
6541
6616
|
case 8 /* BidAskBalanced */: {
|
|
@@ -6543,7 +6618,7 @@ function toStrategyParameters(strategyParameters) {
|
|
|
6543
6618
|
minBinId,
|
|
6544
6619
|
maxBinId,
|
|
6545
6620
|
strategyType: { bidAskBalanced: {} },
|
|
6546
|
-
parameteres: Buffer.from(
|
|
6621
|
+
parameteres: Buffer.from(parameters).toJSON().data
|
|
6547
6622
|
};
|
|
6548
6623
|
}
|
|
6549
6624
|
case 3 /* SpotImBalanced */: {
|
|
@@ -6551,7 +6626,7 @@ function toStrategyParameters(strategyParameters) {
|
|
|
6551
6626
|
minBinId,
|
|
6552
6627
|
maxBinId,
|
|
6553
6628
|
strategyType: { spotImBalanced: {} },
|
|
6554
|
-
parameteres: Buffer.from(
|
|
6629
|
+
parameteres: Buffer.from(parameters).toJSON().data
|
|
6555
6630
|
};
|
|
6556
6631
|
}
|
|
6557
6632
|
case 4 /* CurveImBalanced */: {
|
|
@@ -6559,7 +6634,7 @@ function toStrategyParameters(strategyParameters) {
|
|
|
6559
6634
|
minBinId,
|
|
6560
6635
|
maxBinId,
|
|
6561
6636
|
strategyType: { curveImBalanced: {} },
|
|
6562
|
-
parameteres: Buffer.from(
|
|
6637
|
+
parameteres: Buffer.from(parameters).toJSON().data
|
|
6563
6638
|
};
|
|
6564
6639
|
}
|
|
6565
6640
|
case 5 /* BidAskImBalanced */: {
|
|
@@ -6567,7 +6642,7 @@ function toStrategyParameters(strategyParameters) {
|
|
|
6567
6642
|
minBinId,
|
|
6568
6643
|
maxBinId,
|
|
6569
6644
|
strategyType: { bidAskImBalanced: {} },
|
|
6570
|
-
parameteres: Buffer.from(
|
|
6645
|
+
parameteres: Buffer.from(parameters).toJSON().data
|
|
6571
6646
|
};
|
|
6572
6647
|
}
|
|
6573
6648
|
}
|