@cetusprotocol/aggregator-sdk 0.14.1 → 0.15.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/benchmark-results/benchmark-results-2025-07-17T12-03-15-563Z.csv +3 -0
- package/benchmark-results/benchmark-results-2025-07-17T12-03-15-563Z.json +56 -0
- package/benchmark-results/benchmark-results-2025-07-17T12-03-34-148Z.csv +3 -0
- package/benchmark-results/benchmark-results-2025-07-17T12-03-34-148Z.json +56 -0
- package/benchmark-results/benchmark-results-2025-07-21T03-31-59-263Z.csv +21 -0
- package/benchmark-results/benchmark-results-2025-07-21T03-31-59-263Z.json +444 -0
- package/benchmark-results/benchmark-results-2025-07-21T07-54-54-916Z.csv +21 -0
- package/benchmark-results/benchmark-results-2025-07-21T07-54-54-916Z.json +503 -0
- package/benchmark-results/error-report-2025-07-17T12-03-34-148Z.md +18 -0
- package/benchmark-results/error-report-2025-07-21T03-31-59-263Z.md +18 -0
- package/benchmark-results/error-report-2025-07-21T07-54-54-916Z.md +18 -0
- package/benchmark-results/gas-analysis-report-2025-07-17T12-03-15-563Z.md +80 -0
- package/benchmark-results/gas-analysis-report-2025-07-17T12-03-34-148Z.md +80 -0
- package/benchmark-results/gas-analysis-report-2025-07-21T03-31-59-263Z.md +296 -0
- package/benchmark-results/gas-analysis-report-2025-07-21T07-54-54-916Z.md +323 -0
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +168 -13
- package/dist/index.mjs +167 -13
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -89,6 +89,7 @@ declare const MOMENTUM = "MOMENTUM";
|
|
|
89
89
|
declare const STEAMM_OMM_V2 = "STEAMM_OMM_V2";
|
|
90
90
|
declare const MAGMA = "MAGMA";
|
|
91
91
|
declare const SEVENK = "SEVENK";
|
|
92
|
+
declare const HAEDALHMMV2 = "HAEDALHMMV2";
|
|
92
93
|
declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
93
94
|
declare const ALL_DEXES: string[];
|
|
94
95
|
type BuildRouterSwapParams = {
|
|
@@ -280,6 +281,7 @@ type ExtendedDetails = {
|
|
|
280
281
|
scallopScoinTreasury?: string;
|
|
281
282
|
haedalPmmBasePriceSeed?: string;
|
|
282
283
|
haedalPmmQuotePriceSeed?: string;
|
|
284
|
+
haedalHmmV2BasePriceSeed?: string;
|
|
283
285
|
steammBankA?: string;
|
|
284
286
|
steammBankB?: string;
|
|
285
287
|
steammLendingMarket?: string;
|
|
@@ -337,7 +339,7 @@ type RouterData = {
|
|
|
337
339
|
byAmountIn: boolean;
|
|
338
340
|
routes: Router[];
|
|
339
341
|
insufficientLiquidity: boolean;
|
|
340
|
-
deviationRatio
|
|
342
|
+
deviationRatio?: number;
|
|
341
343
|
packages?: Map<string, string>;
|
|
342
344
|
totalDeepFee?: number;
|
|
343
345
|
error?: RouterError;
|
|
@@ -373,4 +375,4 @@ declare enum Env {
|
|
|
373
375
|
Testnet = 1
|
|
374
376
|
}
|
|
375
377
|
|
|
376
|
-
export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALL_DEXES, ALPHAFI, AggregatorClient, type AggregatorClientParams, type AggregatorResponse, BLUEFIN, BLUEMOVE, type BuildCoinResult, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, HAEDALPMM, HAWAL, KRIYA, KRIYAV3, MAGMA, METASTABLE, MOMENTUM, OBRIC, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, SEVENK, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, buildInputCoin, checkInvalidSuiAddress, compareCoins, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, findPythPriceIDs, fixSuiObjectId, getAggregatorV2Extend2PublishedAt, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getAllProviders, getDeepbookV3Config, getProvidersExcluding, getProvidersIncluding, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
|
|
378
|
+
export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALL_DEXES, ALPHAFI, AggregatorClient, type AggregatorClientParams, type AggregatorResponse, BLUEFIN, BLUEMOVE, type BuildCoinResult, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, HAEDALHMMV2, HAEDALPMM, HAWAL, KRIYA, KRIYAV3, MAGMA, METASTABLE, MOMENTUM, OBRIC, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, SEVENK, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, buildInputCoin, checkInvalidSuiAddress, compareCoins, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, findPythPriceIDs, fixSuiObjectId, getAggregatorV2Extend2PublishedAt, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getAllProviders, getDeepbookV3Config, getProvidersExcluding, getProvidersIncluding, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -89,6 +89,7 @@ declare const MOMENTUM = "MOMENTUM";
|
|
|
89
89
|
declare const STEAMM_OMM_V2 = "STEAMM_OMM_V2";
|
|
90
90
|
declare const MAGMA = "MAGMA";
|
|
91
91
|
declare const SEVENK = "SEVENK";
|
|
92
|
+
declare const HAEDALHMMV2 = "HAEDALHMMV2";
|
|
92
93
|
declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
93
94
|
declare const ALL_DEXES: string[];
|
|
94
95
|
type BuildRouterSwapParams = {
|
|
@@ -280,6 +281,7 @@ type ExtendedDetails = {
|
|
|
280
281
|
scallopScoinTreasury?: string;
|
|
281
282
|
haedalPmmBasePriceSeed?: string;
|
|
282
283
|
haedalPmmQuotePriceSeed?: string;
|
|
284
|
+
haedalHmmV2BasePriceSeed?: string;
|
|
283
285
|
steammBankA?: string;
|
|
284
286
|
steammBankB?: string;
|
|
285
287
|
steammLendingMarket?: string;
|
|
@@ -337,7 +339,7 @@ type RouterData = {
|
|
|
337
339
|
byAmountIn: boolean;
|
|
338
340
|
routes: Router[];
|
|
339
341
|
insufficientLiquidity: boolean;
|
|
340
|
-
deviationRatio
|
|
342
|
+
deviationRatio?: number;
|
|
341
343
|
packages?: Map<string, string>;
|
|
342
344
|
totalDeepFee?: number;
|
|
343
345
|
error?: RouterError;
|
|
@@ -373,4 +375,4 @@ declare enum Env {
|
|
|
373
375
|
Testnet = 1
|
|
374
376
|
}
|
|
375
377
|
|
|
376
|
-
export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALL_DEXES, ALPHAFI, AggregatorClient, type AggregatorClientParams, type AggregatorResponse, BLUEFIN, BLUEMOVE, type BuildCoinResult, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, HAEDALPMM, HAWAL, KRIYA, KRIYAV3, MAGMA, METASTABLE, MOMENTUM, OBRIC, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, SEVENK, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, buildInputCoin, checkInvalidSuiAddress, compareCoins, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, findPythPriceIDs, fixSuiObjectId, getAggregatorV2Extend2PublishedAt, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getAllProviders, getDeepbookV3Config, getProvidersExcluding, getProvidersIncluding, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
|
|
378
|
+
export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALL_DEXES, ALPHAFI, AggregatorClient, type AggregatorClientParams, type AggregatorResponse, BLUEFIN, BLUEMOVE, type BuildCoinResult, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, HAEDALHMMV2, HAEDALPMM, HAWAL, KRIYA, KRIYAV3, MAGMA, METASTABLE, MOMENTUM, OBRIC, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, SEVENK, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, buildInputCoin, checkInvalidSuiAddress, compareCoins, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, findPythPriceIDs, fixSuiObjectId, getAggregatorV2Extend2PublishedAt, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getAllProviders, getDeepbookV3Config, getProvidersExcluding, getProvidersIncluding, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
|
package/dist/index.js
CHANGED
|
@@ -5452,6 +5452,7 @@ var COIN_TYPE = "0x2::coin::Coin";
|
|
|
5452
5452
|
var COIN_TYPE_ARG_REGEX = /^0x2::coin::Coin<(.+)>$/;
|
|
5453
5453
|
var GAS_TYPE_ARG = "0x2::sui::SUI";
|
|
5454
5454
|
var GAS_TYPE_ARG_LONG = "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";
|
|
5455
|
+
var SUI_SYSTEM_STATE_OBJECT_ID = "0x0000000000000000000000000000000000000005";
|
|
5455
5456
|
var CoinUtils = class _CoinUtils {
|
|
5456
5457
|
/**
|
|
5457
5458
|
* Get the coin type argument from a SuiMoveObject.
|
|
@@ -6257,6 +6258,7 @@ var SteammCPMM = class {
|
|
|
6257
6258
|
if (env !== 0 /* Mainnet */) {
|
|
6258
6259
|
throw new Error("Steamm only supported on mainnet");
|
|
6259
6260
|
}
|
|
6261
|
+
this.steammPublishedAt = "0x5ef2a1bca239764c8381ba26b758833060eadb8903682e4fb15e58c6406e2488";
|
|
6260
6262
|
}
|
|
6261
6263
|
swap(client, txb, path, inputCoin, packages) {
|
|
6262
6264
|
return __async(this, null, function* () {
|
|
@@ -6295,7 +6297,10 @@ var SteammCPMM = class {
|
|
|
6295
6297
|
inputCoin,
|
|
6296
6298
|
txb.object(CLOCK_ADDRESS)
|
|
6297
6299
|
];
|
|
6298
|
-
const publishedAt = getAggregatorV2Extend2PublishedAt(
|
|
6300
|
+
const publishedAt = getAggregatorV2Extend2PublishedAt(
|
|
6301
|
+
client.publishedAtV2Extend2(),
|
|
6302
|
+
packages
|
|
6303
|
+
);
|
|
6299
6304
|
const res = txb.moveCall({
|
|
6300
6305
|
target: `${publishedAt}::steamm_cpmm::${func}`,
|
|
6301
6306
|
typeArguments: [
|
|
@@ -6308,10 +6313,54 @@ var SteammCPMM = class {
|
|
|
6308
6313
|
],
|
|
6309
6314
|
arguments: args
|
|
6310
6315
|
});
|
|
6316
|
+
rebalanceMoveCall(
|
|
6317
|
+
txb,
|
|
6318
|
+
this.steammPublishedAt,
|
|
6319
|
+
path.extendedDetails.steammBankA,
|
|
6320
|
+
path.extendedDetails.steammLendingMarket,
|
|
6321
|
+
path.extendedDetails.steammLendingMarketType,
|
|
6322
|
+
coinAType,
|
|
6323
|
+
path.extendedDetails.steammBCoinAType
|
|
6324
|
+
);
|
|
6325
|
+
rebalanceMoveCall(
|
|
6326
|
+
txb,
|
|
6327
|
+
this.steammPublishedAt,
|
|
6328
|
+
path.extendedDetails.steammBankB,
|
|
6329
|
+
path.extendedDetails.steammLendingMarket,
|
|
6330
|
+
path.extendedDetails.steammLendingMarketType,
|
|
6331
|
+
coinBType,
|
|
6332
|
+
path.extendedDetails.steammBCoinBType
|
|
6333
|
+
);
|
|
6311
6334
|
return res;
|
|
6312
6335
|
});
|
|
6313
6336
|
}
|
|
6314
6337
|
};
|
|
6338
|
+
function rebalanceMoveCall(txb, publishedAt, bank, lendingMarket, lendingMarketType, coinType, BcoinType) {
|
|
6339
|
+
if (coinType === "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
|
|
6340
|
+
const rebalanceArgs = [
|
|
6341
|
+
txb.object(bank),
|
|
6342
|
+
txb.object(lendingMarket),
|
|
6343
|
+
txb.object(SUI_SYSTEM_STATE_OBJECT_ID),
|
|
6344
|
+
txb.object(CLOCK_ADDRESS)
|
|
6345
|
+
];
|
|
6346
|
+
txb.moveCall({
|
|
6347
|
+
target: `${publishedAt}::bank::rebalance_sui`,
|
|
6348
|
+
typeArguments: [lendingMarketType, BcoinType],
|
|
6349
|
+
arguments: rebalanceArgs
|
|
6350
|
+
});
|
|
6351
|
+
} else {
|
|
6352
|
+
const rebalanceArgs = [
|
|
6353
|
+
txb.object(bank),
|
|
6354
|
+
txb.object(lendingMarket),
|
|
6355
|
+
txb.object(CLOCK_ADDRESS)
|
|
6356
|
+
];
|
|
6357
|
+
txb.moveCall({
|
|
6358
|
+
target: `${publishedAt}::bank::rebalance`,
|
|
6359
|
+
typeArguments: [lendingMarketType, coinType, BcoinType],
|
|
6360
|
+
arguments: rebalanceArgs
|
|
6361
|
+
});
|
|
6362
|
+
}
|
|
6363
|
+
}
|
|
6315
6364
|
|
|
6316
6365
|
// src/transaction/steamm_omm.ts
|
|
6317
6366
|
var SteammOmm = class {
|
|
@@ -6660,6 +6709,7 @@ var SteammOmmV2 = class {
|
|
|
6660
6709
|
}
|
|
6661
6710
|
this.pythPriceIDs = pythPriceIDs;
|
|
6662
6711
|
this.oraclePackageId = "0xe84b649199654d18c38e727212f5d8dacfc3cf78d60d0a7fc85fd589f280eb2b";
|
|
6712
|
+
this.steammPublishedAt = "0x5ef2a1bca239764c8381ba26b758833060eadb8903682e4fb15e58c6406e2488";
|
|
6663
6713
|
}
|
|
6664
6714
|
swap(client, txb, path, inputCoin, packages) {
|
|
6665
6715
|
return __async(this, null, function* () {
|
|
@@ -6710,7 +6760,9 @@ var SteammOmmV2 = class {
|
|
|
6710
6760
|
const priceInfoObjectIdA = this.pythPriceIDs.get(priceSeedA);
|
|
6711
6761
|
const priceInfoObjectIdB = this.pythPriceIDs.get(priceSeedB);
|
|
6712
6762
|
if (!priceInfoObjectIdA || !priceInfoObjectIdB) {
|
|
6713
|
-
throw new Error(
|
|
6763
|
+
throw new Error(
|
|
6764
|
+
"Base price info object id or quote price info object id not found"
|
|
6765
|
+
);
|
|
6714
6766
|
}
|
|
6715
6767
|
const oraclePriceUpdateA = txb.moveCall({
|
|
6716
6768
|
target: `${this.oraclePackageId}::oracles::get_pyth_price`,
|
|
@@ -6742,7 +6794,10 @@ var SteammOmmV2 = class {
|
|
|
6742
6794
|
inputCoin,
|
|
6743
6795
|
txb.object(CLOCK_ADDRESS)
|
|
6744
6796
|
];
|
|
6745
|
-
const publishedAt = getAggregatorV2Extend2PublishedAt(
|
|
6797
|
+
const publishedAt = getAggregatorV2Extend2PublishedAt(
|
|
6798
|
+
client.publishedAtV2Extend2(),
|
|
6799
|
+
packages
|
|
6800
|
+
);
|
|
6746
6801
|
const res = txb.moveCall({
|
|
6747
6802
|
target: `${publishedAt}::steamm_omm_v2::${func}`,
|
|
6748
6803
|
typeArguments: [
|
|
@@ -6755,10 +6810,54 @@ var SteammOmmV2 = class {
|
|
|
6755
6810
|
],
|
|
6756
6811
|
arguments: args
|
|
6757
6812
|
});
|
|
6813
|
+
rebalanceMoveCall2(
|
|
6814
|
+
txb,
|
|
6815
|
+
this.steammPublishedAt,
|
|
6816
|
+
path.extendedDetails.steammBankA,
|
|
6817
|
+
path.extendedDetails.steammLendingMarket,
|
|
6818
|
+
path.extendedDetails.steammLendingMarketType,
|
|
6819
|
+
coinAType,
|
|
6820
|
+
path.extendedDetails.steammBCoinAType
|
|
6821
|
+
);
|
|
6822
|
+
rebalanceMoveCall2(
|
|
6823
|
+
txb,
|
|
6824
|
+
this.steammPublishedAt,
|
|
6825
|
+
path.extendedDetails.steammBankB,
|
|
6826
|
+
path.extendedDetails.steammLendingMarket,
|
|
6827
|
+
path.extendedDetails.steammLendingMarketType,
|
|
6828
|
+
coinBType,
|
|
6829
|
+
path.extendedDetails.steammBCoinBType
|
|
6830
|
+
);
|
|
6758
6831
|
return res;
|
|
6759
6832
|
});
|
|
6760
6833
|
}
|
|
6761
6834
|
};
|
|
6835
|
+
function rebalanceMoveCall2(txb, publishedAt, bank, lendingMarket, lendingMarketType, coinType, BcoinType) {
|
|
6836
|
+
if (coinType === "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
|
|
6837
|
+
const rebalanceArgs = [
|
|
6838
|
+
txb.object(bank),
|
|
6839
|
+
txb.object(lendingMarket),
|
|
6840
|
+
txb.object(SUI_SYSTEM_STATE_OBJECT_ID),
|
|
6841
|
+
txb.object(CLOCK_ADDRESS)
|
|
6842
|
+
];
|
|
6843
|
+
txb.moveCall({
|
|
6844
|
+
target: `${publishedAt}::bank::rebalance_sui`,
|
|
6845
|
+
typeArguments: [lendingMarketType, BcoinType],
|
|
6846
|
+
arguments: rebalanceArgs
|
|
6847
|
+
});
|
|
6848
|
+
} else {
|
|
6849
|
+
const rebalanceArgs = [
|
|
6850
|
+
txb.object(bank),
|
|
6851
|
+
txb.object(lendingMarket),
|
|
6852
|
+
txb.object(CLOCK_ADDRESS)
|
|
6853
|
+
];
|
|
6854
|
+
txb.moveCall({
|
|
6855
|
+
target: `${publishedAt}::bank::rebalance`,
|
|
6856
|
+
typeArguments: [lendingMarketType, coinType, BcoinType],
|
|
6857
|
+
arguments: rebalanceArgs
|
|
6858
|
+
});
|
|
6859
|
+
}
|
|
6860
|
+
}
|
|
6762
6861
|
|
|
6763
6862
|
// src/transaction/magma.ts
|
|
6764
6863
|
var Magma = class {
|
|
@@ -6870,6 +6969,51 @@ var Sevenk = class {
|
|
|
6870
6969
|
}
|
|
6871
6970
|
};
|
|
6872
6971
|
|
|
6972
|
+
// src/transaction/haedal_hmm_v2.ts
|
|
6973
|
+
var HaedalHMMV2 = class {
|
|
6974
|
+
constructor(env, pythPriceIDs) {
|
|
6975
|
+
if (env === 1 /* Testnet */) {
|
|
6976
|
+
throw new Error("HaedalHMMV2 is not supported on testnet");
|
|
6977
|
+
}
|
|
6978
|
+
this.pythPriceIDs = pythPriceIDs;
|
|
6979
|
+
}
|
|
6980
|
+
swap(client, txb, path, inputCoin, packages) {
|
|
6981
|
+
return __async(this, null, function* () {
|
|
6982
|
+
const { direction, from, target } = path;
|
|
6983
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
6984
|
+
let basePriceSeed;
|
|
6985
|
+
if (path.extendedDetails == null) {
|
|
6986
|
+
throw new Error("Extended details not supported haedal pmm");
|
|
6987
|
+
} else {
|
|
6988
|
+
if (!path.extendedDetails.haedalHmmV2BasePriceSeed) {
|
|
6989
|
+
throw new Error("Base price seed not supported");
|
|
6990
|
+
}
|
|
6991
|
+
basePriceSeed = path.extendedDetails.haedalHmmV2BasePriceSeed;
|
|
6992
|
+
}
|
|
6993
|
+
const basePriceInfoObjectId = this.pythPriceIDs.get(basePriceSeed);
|
|
6994
|
+
if (!basePriceInfoObjectId) {
|
|
6995
|
+
throw new Error("Base price info object id not found");
|
|
6996
|
+
}
|
|
6997
|
+
const args = [
|
|
6998
|
+
txb.object(path.id),
|
|
6999
|
+
txb.object(basePriceInfoObjectId),
|
|
7000
|
+
inputCoin,
|
|
7001
|
+
txb.object(CLOCK_ADDRESS)
|
|
7002
|
+
];
|
|
7003
|
+
const publishedAt = getAggregatorV2Extend2PublishedAt(
|
|
7004
|
+
client.publishedAtV2Extend2(),
|
|
7005
|
+
packages
|
|
7006
|
+
);
|
|
7007
|
+
const res = txb.moveCall({
|
|
7008
|
+
target: `${publishedAt}::haedal_hmm_v2::${func}`,
|
|
7009
|
+
typeArguments: [coinAType, coinBType],
|
|
7010
|
+
arguments: args
|
|
7011
|
+
});
|
|
7012
|
+
return res;
|
|
7013
|
+
});
|
|
7014
|
+
}
|
|
7015
|
+
};
|
|
7016
|
+
|
|
6873
7017
|
// src/client.ts
|
|
6874
7018
|
var CETUS = "CETUS";
|
|
6875
7019
|
var DEEPBOOKV2 = "DEEPBOOK";
|
|
@@ -6899,6 +7043,7 @@ var MOMENTUM = "MOMENTUM";
|
|
|
6899
7043
|
var STEAMM_OMM_V2 = "STEAMM_OMM_V2";
|
|
6900
7044
|
var MAGMA = "MAGMA";
|
|
6901
7045
|
var SEVENK = "SEVENK";
|
|
7046
|
+
var HAEDALHMMV2 = "HAEDALHMMV2";
|
|
6902
7047
|
var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
6903
7048
|
var ALL_DEXES = [
|
|
6904
7049
|
CETUS,
|
|
@@ -6927,7 +7072,8 @@ var ALL_DEXES = [
|
|
|
6927
7072
|
STEAMM_OMM,
|
|
6928
7073
|
STEAMM_OMM_V2,
|
|
6929
7074
|
MAGMA,
|
|
6930
|
-
SEVENK
|
|
7075
|
+
SEVENK,
|
|
7076
|
+
HAEDALHMMV2
|
|
6931
7077
|
];
|
|
6932
7078
|
function isBuilderRouterSwapParams(params) {
|
|
6933
7079
|
return Array.isArray(params.routers);
|
|
@@ -7482,14 +7628,14 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7482
7628
|
// Include deepbookv3, scallop, bluefin
|
|
7483
7629
|
publishedAtV2Extend() {
|
|
7484
7630
|
if (this.env === 0 /* Mainnet */) {
|
|
7485
|
-
return "
|
|
7631
|
+
return "0xb39d6dddedd16ed8a40ce0b1e6b43c92acf0ff3fa2fac081fb82ef1b915c17b4";
|
|
7486
7632
|
} else {
|
|
7487
7633
|
return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
|
|
7488
7634
|
}
|
|
7489
7635
|
}
|
|
7490
7636
|
publishedAtV2Extend2() {
|
|
7491
7637
|
if (this.env === 0 /* Mainnet */) {
|
|
7492
|
-
return "
|
|
7638
|
+
return "0xfb34ee252871013594c87a84bd2718d1603f3ee2503f075b9fbcdfc829b707f4";
|
|
7493
7639
|
} else {
|
|
7494
7640
|
return "0x0";
|
|
7495
7641
|
}
|
|
@@ -7602,6 +7748,8 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7602
7748
|
return new Magma(this.env);
|
|
7603
7749
|
case SEVENK:
|
|
7604
7750
|
return new Sevenk(this.env, pythPriceIDs);
|
|
7751
|
+
case HAEDALHMMV2:
|
|
7752
|
+
return new HaedalHMMV2(this.env, pythPriceIDs);
|
|
7605
7753
|
default:
|
|
7606
7754
|
throw new Error(`Unsupported dex ${provider}`);
|
|
7607
7755
|
}
|
|
@@ -7697,7 +7845,7 @@ _AggregatorClient.CONFIG = {
|
|
|
7697
7845
|
pythStateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"
|
|
7698
7846
|
}
|
|
7699
7847
|
};
|
|
7700
|
-
var
|
|
7848
|
+
var AggregatorClient29 = _AggregatorClient;
|
|
7701
7849
|
function findPythPriceIDs(routes) {
|
|
7702
7850
|
const priceIDs = /* @__PURE__ */ new Set();
|
|
7703
7851
|
for (const route of routes) {
|
|
@@ -7740,6 +7888,11 @@ function findPythPriceIDs(routes) {
|
|
|
7740
7888
|
priceIDs.add(path.extendedDetails.sevenkCoinBPriceSeed);
|
|
7741
7889
|
}
|
|
7742
7890
|
}
|
|
7891
|
+
if (path.provider === HAEDALHMMV2) {
|
|
7892
|
+
if (path.extendedDetails && path.extendedDetails.haedalHmmV2BasePriceSeed) {
|
|
7893
|
+
priceIDs.add(path.extendedDetails.haedalHmmV2BasePriceSeed);
|
|
7894
|
+
}
|
|
7895
|
+
}
|
|
7743
7896
|
}
|
|
7744
7897
|
}
|
|
7745
7898
|
return Array.from(priceIDs);
|
|
@@ -7763,19 +7916,19 @@ function parseRouterResponse(data, byAmountIn) {
|
|
|
7763
7916
|
let routerData = {
|
|
7764
7917
|
amountIn: new import_bn5.default(data.amount_in.toString()),
|
|
7765
7918
|
amountOut: new import_bn5.default(data.amount_out.toString()),
|
|
7766
|
-
deviationRatio: data.deviation_ratio ? Number(data.deviation_ratio) : 0,
|
|
7919
|
+
deviationRatio: data.deviation_ratio ? Number(data.deviation_ratio) : void 0,
|
|
7767
7920
|
byAmountIn,
|
|
7768
7921
|
insufficientLiquidity: false,
|
|
7769
7922
|
routes: data.routes.map((route) => {
|
|
7770
7923
|
return {
|
|
7771
7924
|
path: route.path.map((path) => {
|
|
7772
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I;
|
|
7925
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J;
|
|
7773
7926
|
let version;
|
|
7774
7927
|
if (path.provider === AFTERMATH) {
|
|
7775
7928
|
version = path.extended_details.aftermath_pool_flatness === 0 ? "v2" : "v3";
|
|
7776
7929
|
}
|
|
7777
7930
|
let extendedDetails;
|
|
7778
|
-
if (path.provider === TURBOS || path.provider === AFTERMATH || path.provider === CETUS || path.provider === DEEPBOOKV3 || path.provider === SCALLOP || path.provider === HAEDALPMM || path.provider === METASTABLE || path.provider === OBRIC || path.provider === STEAMM || path.provider === STEAMM_OMM || path.provider === STEAMM_OMM_V2 || path.provider === SEVENK) {
|
|
7931
|
+
if (path.provider === TURBOS || path.provider === AFTERMATH || path.provider === CETUS || path.provider === DEEPBOOKV3 || path.provider === SCALLOP || path.provider === HAEDALPMM || path.provider === METASTABLE || path.provider === OBRIC || path.provider === STEAMM || path.provider === STEAMM_OMM || path.provider === STEAMM_OMM_V2 || path.provider === SEVENK || path.provider === HAEDALHMMV2) {
|
|
7779
7932
|
extendedDetails = {
|
|
7780
7933
|
aftermathLpSupplyType: (_a = path.extended_details) == null ? void 0 : _a.aftermath_lp_supply_type,
|
|
7781
7934
|
turbosFeeType: (_b = path.extended_details) == null ? void 0 : _b.turbos_fee_type,
|
|
@@ -7811,7 +7964,8 @@ function parseRouterResponse(data, byAmountIn) {
|
|
|
7811
7964
|
sevenkCoinBPriceSeed: (_F = path.extended_details) == null ? void 0 : _F.sevenk_coin_b_price_seed,
|
|
7812
7965
|
sevenkCoinAOracleId: (_G = path.extended_details) == null ? void 0 : _G.sevenk_oracle_config_a,
|
|
7813
7966
|
sevenkCoinBOracleId: (_H = path.extended_details) == null ? void 0 : _H.sevenk_oracle_config_b,
|
|
7814
|
-
sevenkLPCapType: (_I = path.extended_details) == null ? void 0 : _I.sevenk_lp_cap_type
|
|
7967
|
+
sevenkLPCapType: (_I = path.extended_details) == null ? void 0 : _I.sevenk_lp_cap_type,
|
|
7968
|
+
haedalHmmV2BasePriceSeed: (_J = path.extended_details) == null ? void 0 : _J.haedalhmmv2_base_price_seed
|
|
7815
7969
|
};
|
|
7816
7970
|
}
|
|
7817
7971
|
return {
|
|
@@ -7908,7 +8062,7 @@ function processEndpoint(endpoint) {
|
|
|
7908
8062
|
|
|
7909
8063
|
// src/api.ts
|
|
7910
8064
|
var import_bn7 = __toESM(require_bn());
|
|
7911
|
-
var SDK_VERSION =
|
|
8065
|
+
var SDK_VERSION = 1001500;
|
|
7912
8066
|
function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
|
|
7913
8067
|
return __async(this, null, function* () {
|
|
7914
8068
|
let response;
|
|
@@ -8122,7 +8276,7 @@ exports.AGGREGATOR_V2_EXTEND = AGGREGATOR_V2_EXTEND;
|
|
|
8122
8276
|
exports.AGGREGATOR_V2_EXTEND2 = AGGREGATOR_V2_EXTEND2;
|
|
8123
8277
|
exports.ALL_DEXES = ALL_DEXES;
|
|
8124
8278
|
exports.ALPHAFI = ALPHAFI;
|
|
8125
|
-
exports.AggregatorClient =
|
|
8279
|
+
exports.AggregatorClient = AggregatorClient29;
|
|
8126
8280
|
exports.BLUEFIN = BLUEFIN;
|
|
8127
8281
|
exports.BLUEMOVE = BLUEMOVE;
|
|
8128
8282
|
exports.CETUS = CETUS;
|
|
@@ -8134,6 +8288,7 @@ exports.Env = Env;
|
|
|
8134
8288
|
exports.FLOWXV2 = FLOWXV2;
|
|
8135
8289
|
exports.FLOWXV3 = FLOWXV3;
|
|
8136
8290
|
exports.HAEDAL = HAEDAL;
|
|
8291
|
+
exports.HAEDALHMMV2 = HAEDALHMMV2;
|
|
8137
8292
|
exports.HAEDALPMM = HAEDALPMM;
|
|
8138
8293
|
exports.HAWAL = HAWAL;
|
|
8139
8294
|
exports.KRIYA = KRIYA;
|