@cetusprotocol/aggregator-sdk 1.4.2 → 1.4.3
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.mts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +48 -3
- package/dist/index.mjs +48 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -87,8 +87,11 @@ type ExtendedDetails = {
|
|
|
87
87
|
aftermath_lp_supply_type?: string;
|
|
88
88
|
turbos_fee_type?: string;
|
|
89
89
|
afterSqrtPrice?: string;
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
deepbookv3_deep_fee?: number;
|
|
91
|
+
deepbookv3_need_add_deep_price_point?: boolean;
|
|
92
|
+
deepbookv3_reference_pool_id?: string;
|
|
93
|
+
deepbookv3_reference_pool_base_type?: string;
|
|
94
|
+
deepbookv3_reference_pool_quote_type?: string;
|
|
92
95
|
scallop_scoin_treasury?: string;
|
|
93
96
|
haedal_pmm_base_price_seed?: string;
|
|
94
97
|
haedal_pmm_quote_price_seed?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -87,8 +87,11 @@ type ExtendedDetails = {
|
|
|
87
87
|
aftermath_lp_supply_type?: string;
|
|
88
88
|
turbos_fee_type?: string;
|
|
89
89
|
afterSqrtPrice?: string;
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
deepbookv3_deep_fee?: number;
|
|
91
|
+
deepbookv3_need_add_deep_price_point?: boolean;
|
|
92
|
+
deepbookv3_reference_pool_id?: string;
|
|
93
|
+
deepbookv3_reference_pool_base_type?: string;
|
|
94
|
+
deepbookv3_reference_pool_quote_type?: string;
|
|
92
95
|
scallop_scoin_treasury?: string;
|
|
93
96
|
haedal_pmm_base_price_seed?: string;
|
|
94
97
|
haedal_pmm_quote_price_seed?: string;
|
package/dist/index.js
CHANGED
|
@@ -3452,7 +3452,7 @@ var AGGREGATOR_V3_CONFIG = {
|
|
|
3452
3452
|
};
|
|
3453
3453
|
|
|
3454
3454
|
// src/api.ts
|
|
3455
|
-
var SDK_VERSION =
|
|
3455
|
+
var SDK_VERSION = 1010403;
|
|
3456
3456
|
function parseRouterResponse(data, byAmountIn) {
|
|
3457
3457
|
let packages = /* @__PURE__ */ new Map();
|
|
3458
3458
|
if (data.packages) {
|
|
@@ -6612,24 +6612,69 @@ var DeepbookV3Router = class {
|
|
|
6612
6612
|
}
|
|
6613
6613
|
swap(txb, flattenedPath, swapContext, _extends) {
|
|
6614
6614
|
const swapData = this.prepareSwapData(flattenedPath);
|
|
6615
|
+
if (swapData.needAddDeepPricePoint) {
|
|
6616
|
+
this.addDeepPricePoint(txb, swapData);
|
|
6617
|
+
}
|
|
6615
6618
|
this.executeSwapContract(txb, swapData, swapContext, _extends);
|
|
6616
6619
|
}
|
|
6617
6620
|
prepareSwapData(flattenedPath) {
|
|
6621
|
+
var _a, _b, _c, _d, _e;
|
|
6618
6622
|
if (flattenedPath.path.publishedAt == null) {
|
|
6619
6623
|
throw new Error("DeepBook V3 not set publishedAt");
|
|
6620
6624
|
}
|
|
6621
6625
|
const path = flattenedPath.path;
|
|
6622
6626
|
const [coinAType, coinBType] = path.direction ? [path.from, path.target] : [path.target, path.from];
|
|
6623
6627
|
const amountIn = flattenedPath.isLastUseOfIntermediateToken ? AGGREGATOR_V3_CONFIG.MAX_AMOUNT_IN : path.amountIn;
|
|
6628
|
+
const needAddDeepPricePoint = (_b = (_a = path.extendedDetails) == null ? void 0 : _a.deepbookv3_need_add_deep_price_point) != null ? _b : false;
|
|
6629
|
+
const referencePoolId = (_c = path.extendedDetails) == null ? void 0 : _c.deepbookv3_reference_pool_id;
|
|
6630
|
+
const referencePoolBaseType = (_d = path.extendedDetails) == null ? void 0 : _d.deepbookv3_reference_pool_base_type;
|
|
6631
|
+
const referencePoolQuoteType = (_e = path.extendedDetails) == null ? void 0 : _e.deepbookv3_reference_pool_quote_type;
|
|
6632
|
+
if (needAddDeepPricePoint) {
|
|
6633
|
+
if (!referencePoolId) {
|
|
6634
|
+
throw new Error(
|
|
6635
|
+
"DeepBook V3: deepbookv3_reference_pool_id is required when deepbookv3_need_add_deep_price_point is true"
|
|
6636
|
+
);
|
|
6637
|
+
}
|
|
6638
|
+
if (!referencePoolBaseType) {
|
|
6639
|
+
throw new Error(
|
|
6640
|
+
"DeepBook V3: reference_pool_base_type is required when deepbookv3_need_add_deep_price_point is true"
|
|
6641
|
+
);
|
|
6642
|
+
}
|
|
6643
|
+
if (!referencePoolQuoteType) {
|
|
6644
|
+
throw new Error(
|
|
6645
|
+
"DeepBook V3: reference_pool_quote_type is required when deepbookv3_need_add_deep_price_point is true"
|
|
6646
|
+
);
|
|
6647
|
+
}
|
|
6648
|
+
}
|
|
6624
6649
|
return {
|
|
6625
6650
|
coinAType,
|
|
6626
6651
|
coinBType,
|
|
6627
6652
|
direction: path.direction,
|
|
6628
6653
|
amountIn,
|
|
6629
6654
|
publishedAt: path.publishedAt,
|
|
6630
|
-
poolId: path.id
|
|
6655
|
+
poolId: path.id,
|
|
6656
|
+
needAddDeepPricePoint,
|
|
6657
|
+
referencePoolId,
|
|
6658
|
+
referencePoolBaseType,
|
|
6659
|
+
referencePoolQuoteType
|
|
6631
6660
|
};
|
|
6632
6661
|
}
|
|
6662
|
+
addDeepPricePoint(txb, swapData) {
|
|
6663
|
+
txb.moveCall({
|
|
6664
|
+
target: `${swapData.publishedAt}::deepbookv3::add_deep_price_point`,
|
|
6665
|
+
typeArguments: [
|
|
6666
|
+
swapData.coinAType,
|
|
6667
|
+
swapData.coinBType,
|
|
6668
|
+
swapData.referencePoolBaseType,
|
|
6669
|
+
swapData.referencePoolQuoteType
|
|
6670
|
+
],
|
|
6671
|
+
arguments: [
|
|
6672
|
+
txb.object(swapData.poolId),
|
|
6673
|
+
txb.object(swapData.referencePoolId),
|
|
6674
|
+
txb.object(utils.SUI_CLOCK_OBJECT_ID)
|
|
6675
|
+
]
|
|
6676
|
+
});
|
|
6677
|
+
}
|
|
6633
6678
|
executeSwapContract(txb, swapData, swapContext, _extends) {
|
|
6634
6679
|
const deepCoin = (_extends == null ? void 0 : _extends.deepbookv3DeepFee) || txb.moveCall({
|
|
6635
6680
|
target: "0x2::coin::zero",
|
|
@@ -6817,7 +6862,7 @@ var ScallopRouter = class {
|
|
|
6817
6862
|
if (path.extendedDetails == null) {
|
|
6818
6863
|
throw new Error("Extended details not supported");
|
|
6819
6864
|
}
|
|
6820
|
-
const scallopScoinTreasury = path.extendedDetails.
|
|
6865
|
+
const scallopScoinTreasury = path.extendedDetails.scallop_scoin_treasury;
|
|
6821
6866
|
if (scallopScoinTreasury == null) {
|
|
6822
6867
|
throw new Error("Scallop scoin treasury not supported");
|
|
6823
6868
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -3446,7 +3446,7 @@ var AGGREGATOR_V3_CONFIG = {
|
|
|
3446
3446
|
};
|
|
3447
3447
|
|
|
3448
3448
|
// src/api.ts
|
|
3449
|
-
var SDK_VERSION =
|
|
3449
|
+
var SDK_VERSION = 1010403;
|
|
3450
3450
|
function parseRouterResponse(data, byAmountIn) {
|
|
3451
3451
|
let packages = /* @__PURE__ */ new Map();
|
|
3452
3452
|
if (data.packages) {
|
|
@@ -6606,24 +6606,69 @@ var DeepbookV3Router = class {
|
|
|
6606
6606
|
}
|
|
6607
6607
|
swap(txb, flattenedPath, swapContext, _extends) {
|
|
6608
6608
|
const swapData = this.prepareSwapData(flattenedPath);
|
|
6609
|
+
if (swapData.needAddDeepPricePoint) {
|
|
6610
|
+
this.addDeepPricePoint(txb, swapData);
|
|
6611
|
+
}
|
|
6609
6612
|
this.executeSwapContract(txb, swapData, swapContext, _extends);
|
|
6610
6613
|
}
|
|
6611
6614
|
prepareSwapData(flattenedPath) {
|
|
6615
|
+
var _a, _b, _c, _d, _e;
|
|
6612
6616
|
if (flattenedPath.path.publishedAt == null) {
|
|
6613
6617
|
throw new Error("DeepBook V3 not set publishedAt");
|
|
6614
6618
|
}
|
|
6615
6619
|
const path = flattenedPath.path;
|
|
6616
6620
|
const [coinAType, coinBType] = path.direction ? [path.from, path.target] : [path.target, path.from];
|
|
6617
6621
|
const amountIn = flattenedPath.isLastUseOfIntermediateToken ? AGGREGATOR_V3_CONFIG.MAX_AMOUNT_IN : path.amountIn;
|
|
6622
|
+
const needAddDeepPricePoint = (_b = (_a = path.extendedDetails) == null ? void 0 : _a.deepbookv3_need_add_deep_price_point) != null ? _b : false;
|
|
6623
|
+
const referencePoolId = (_c = path.extendedDetails) == null ? void 0 : _c.deepbookv3_reference_pool_id;
|
|
6624
|
+
const referencePoolBaseType = (_d = path.extendedDetails) == null ? void 0 : _d.deepbookv3_reference_pool_base_type;
|
|
6625
|
+
const referencePoolQuoteType = (_e = path.extendedDetails) == null ? void 0 : _e.deepbookv3_reference_pool_quote_type;
|
|
6626
|
+
if (needAddDeepPricePoint) {
|
|
6627
|
+
if (!referencePoolId) {
|
|
6628
|
+
throw new Error(
|
|
6629
|
+
"DeepBook V3: deepbookv3_reference_pool_id is required when deepbookv3_need_add_deep_price_point is true"
|
|
6630
|
+
);
|
|
6631
|
+
}
|
|
6632
|
+
if (!referencePoolBaseType) {
|
|
6633
|
+
throw new Error(
|
|
6634
|
+
"DeepBook V3: reference_pool_base_type is required when deepbookv3_need_add_deep_price_point is true"
|
|
6635
|
+
);
|
|
6636
|
+
}
|
|
6637
|
+
if (!referencePoolQuoteType) {
|
|
6638
|
+
throw new Error(
|
|
6639
|
+
"DeepBook V3: reference_pool_quote_type is required when deepbookv3_need_add_deep_price_point is true"
|
|
6640
|
+
);
|
|
6641
|
+
}
|
|
6642
|
+
}
|
|
6618
6643
|
return {
|
|
6619
6644
|
coinAType,
|
|
6620
6645
|
coinBType,
|
|
6621
6646
|
direction: path.direction,
|
|
6622
6647
|
amountIn,
|
|
6623
6648
|
publishedAt: path.publishedAt,
|
|
6624
|
-
poolId: path.id
|
|
6649
|
+
poolId: path.id,
|
|
6650
|
+
needAddDeepPricePoint,
|
|
6651
|
+
referencePoolId,
|
|
6652
|
+
referencePoolBaseType,
|
|
6653
|
+
referencePoolQuoteType
|
|
6625
6654
|
};
|
|
6626
6655
|
}
|
|
6656
|
+
addDeepPricePoint(txb, swapData) {
|
|
6657
|
+
txb.moveCall({
|
|
6658
|
+
target: `${swapData.publishedAt}::deepbookv3::add_deep_price_point`,
|
|
6659
|
+
typeArguments: [
|
|
6660
|
+
swapData.coinAType,
|
|
6661
|
+
swapData.coinBType,
|
|
6662
|
+
swapData.referencePoolBaseType,
|
|
6663
|
+
swapData.referencePoolQuoteType
|
|
6664
|
+
],
|
|
6665
|
+
arguments: [
|
|
6666
|
+
txb.object(swapData.poolId),
|
|
6667
|
+
txb.object(swapData.referencePoolId),
|
|
6668
|
+
txb.object(SUI_CLOCK_OBJECT_ID)
|
|
6669
|
+
]
|
|
6670
|
+
});
|
|
6671
|
+
}
|
|
6627
6672
|
executeSwapContract(txb, swapData, swapContext, _extends) {
|
|
6628
6673
|
const deepCoin = (_extends == null ? void 0 : _extends.deepbookv3DeepFee) || txb.moveCall({
|
|
6629
6674
|
target: "0x2::coin::zero",
|
|
@@ -6811,7 +6856,7 @@ var ScallopRouter = class {
|
|
|
6811
6856
|
if (path.extendedDetails == null) {
|
|
6812
6857
|
throw new Error("Extended details not supported");
|
|
6813
6858
|
}
|
|
6814
|
-
const scallopScoinTreasury = path.extendedDetails.
|
|
6859
|
+
const scallopScoinTreasury = path.extendedDetails.scallop_scoin_treasury;
|
|
6815
6860
|
if (scallopScoinTreasury == null) {
|
|
6816
6861
|
throw new Error("Scallop scoin treasury not supported");
|
|
6817
6862
|
}
|