@cetusprotocol/aggregator-sdk 0.14.2 → 0.16.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 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +209 -16
- package/dist/index.mjs +207 -16
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -89,6 +89,8 @@ 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";
|
|
93
|
+
declare const FULLSAIL = "FULLSAIL";
|
|
92
94
|
declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
93
95
|
declare const ALL_DEXES: string[];
|
|
94
96
|
type BuildRouterSwapParams = {
|
|
@@ -280,6 +282,7 @@ type ExtendedDetails = {
|
|
|
280
282
|
scallopScoinTreasury?: string;
|
|
281
283
|
haedalPmmBasePriceSeed?: string;
|
|
282
284
|
haedalPmmQuotePriceSeed?: string;
|
|
285
|
+
haedalHmmV2BasePriceSeed?: string;
|
|
283
286
|
steammBankA?: string;
|
|
284
287
|
steammBankB?: string;
|
|
285
288
|
steammLendingMarket?: string;
|
|
@@ -373,4 +376,4 @@ declare enum Env {
|
|
|
373
376
|
Testnet = 1
|
|
374
377
|
}
|
|
375
378
|
|
|
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 };
|
|
379
|
+
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, FULLSAIL, 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,8 @@ 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";
|
|
93
|
+
declare const FULLSAIL = "FULLSAIL";
|
|
92
94
|
declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
93
95
|
declare const ALL_DEXES: string[];
|
|
94
96
|
type BuildRouterSwapParams = {
|
|
@@ -280,6 +282,7 @@ type ExtendedDetails = {
|
|
|
280
282
|
scallopScoinTreasury?: string;
|
|
281
283
|
haedalPmmBasePriceSeed?: string;
|
|
282
284
|
haedalPmmQuotePriceSeed?: string;
|
|
285
|
+
haedalHmmV2BasePriceSeed?: string;
|
|
283
286
|
steammBankA?: string;
|
|
284
287
|
steammBankB?: string;
|
|
285
288
|
steammLendingMarket?: string;
|
|
@@ -373,4 +376,4 @@ declare enum Env {
|
|
|
373
376
|
Testnet = 1
|
|
374
377
|
}
|
|
375
378
|
|
|
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 };
|
|
379
|
+
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, FULLSAIL, 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,84 @@ 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
|
+
|
|
7017
|
+
// src/transaction/fullsail.ts
|
|
7018
|
+
var FullSail = class {
|
|
7019
|
+
// private partner: string
|
|
7020
|
+
constructor(env) {
|
|
7021
|
+
this.globalConfig = "0xe93baa80cb570b3a494cbf0621b2ba96bc993926d34dc92508c9446f9a05d615";
|
|
7022
|
+
this.rewarder = "0xfb971d3a2fb98bde74e1c30ba15a3d8bef60a02789e59ae0b91660aeed3e64e1";
|
|
7023
|
+
this.stats = "0x6822a33d1d971e040c32f7cc74507010d1fe786f7d06ab89135083ddb07d2dc2";
|
|
7024
|
+
this.price_provider = "0x854b2d2c0381bb656ec962f8b443eb082654384cf97885359d1956c7d76e33c9";
|
|
7025
|
+
}
|
|
7026
|
+
swap(client, txb, path, inputCoin, packages) {
|
|
7027
|
+
return __async(this, null, function* () {
|
|
7028
|
+
const { direction, from, target } = path;
|
|
7029
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
7030
|
+
const args = [
|
|
7031
|
+
txb.object(this.globalConfig),
|
|
7032
|
+
txb.object(this.rewarder),
|
|
7033
|
+
txb.object(path.id),
|
|
7034
|
+
inputCoin,
|
|
7035
|
+
txb.object(this.stats),
|
|
7036
|
+
txb.object(this.price_provider),
|
|
7037
|
+
txb.object(CLOCK_ADDRESS)
|
|
7038
|
+
];
|
|
7039
|
+
const publishedAt = getAggregatorV2Extend2PublishedAt(client.publishedAtV2Extend2(), packages);
|
|
7040
|
+
const res = txb.moveCall({
|
|
7041
|
+
target: `${publishedAt}::fullsail::${func}`,
|
|
7042
|
+
typeArguments: [coinAType, coinBType],
|
|
7043
|
+
arguments: args
|
|
7044
|
+
});
|
|
7045
|
+
return res;
|
|
7046
|
+
});
|
|
7047
|
+
}
|
|
7048
|
+
};
|
|
7049
|
+
|
|
6873
7050
|
// src/client.ts
|
|
6874
7051
|
var CETUS = "CETUS";
|
|
6875
7052
|
var DEEPBOOKV2 = "DEEPBOOK";
|
|
@@ -6899,6 +7076,8 @@ var MOMENTUM = "MOMENTUM";
|
|
|
6899
7076
|
var STEAMM_OMM_V2 = "STEAMM_OMM_V2";
|
|
6900
7077
|
var MAGMA = "MAGMA";
|
|
6901
7078
|
var SEVENK = "SEVENK";
|
|
7079
|
+
var HAEDALHMMV2 = "HAEDALHMMV2";
|
|
7080
|
+
var FULLSAIL = "FULLSAIL";
|
|
6902
7081
|
var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
6903
7082
|
var ALL_DEXES = [
|
|
6904
7083
|
CETUS,
|
|
@@ -6927,7 +7106,9 @@ var ALL_DEXES = [
|
|
|
6927
7106
|
STEAMM_OMM,
|
|
6928
7107
|
STEAMM_OMM_V2,
|
|
6929
7108
|
MAGMA,
|
|
6930
|
-
SEVENK
|
|
7109
|
+
SEVENK,
|
|
7110
|
+
HAEDALHMMV2,
|
|
7111
|
+
FULLSAIL
|
|
6931
7112
|
];
|
|
6932
7113
|
function isBuilderRouterSwapParams(params) {
|
|
6933
7114
|
return Array.isArray(params.routers);
|
|
@@ -7482,14 +7663,14 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7482
7663
|
// Include deepbookv3, scallop, bluefin
|
|
7483
7664
|
publishedAtV2Extend() {
|
|
7484
7665
|
if (this.env === 0 /* Mainnet */) {
|
|
7485
|
-
return "
|
|
7666
|
+
return "0xb39d6dddedd16ed8a40ce0b1e6b43c92acf0ff3fa2fac081fb82ef1b915c17b4";
|
|
7486
7667
|
} else {
|
|
7487
7668
|
return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
|
|
7488
7669
|
}
|
|
7489
7670
|
}
|
|
7490
7671
|
publishedAtV2Extend2() {
|
|
7491
7672
|
if (this.env === 0 /* Mainnet */) {
|
|
7492
|
-
return "
|
|
7673
|
+
return "0x88142be0f2c6b0150980109a7386220b4c040a5c4d9a16d5f7dd0bbd0135ba12";
|
|
7493
7674
|
} else {
|
|
7494
7675
|
return "0x0";
|
|
7495
7676
|
}
|
|
@@ -7602,6 +7783,10 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7602
7783
|
return new Magma(this.env);
|
|
7603
7784
|
case SEVENK:
|
|
7604
7785
|
return new Sevenk(this.env, pythPriceIDs);
|
|
7786
|
+
case HAEDALHMMV2:
|
|
7787
|
+
return new HaedalHMMV2(this.env, pythPriceIDs);
|
|
7788
|
+
case FULLSAIL:
|
|
7789
|
+
return new FullSail(this.env);
|
|
7605
7790
|
default:
|
|
7606
7791
|
throw new Error(`Unsupported dex ${provider}`);
|
|
7607
7792
|
}
|
|
@@ -7697,7 +7882,7 @@ _AggregatorClient.CONFIG = {
|
|
|
7697
7882
|
pythStateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"
|
|
7698
7883
|
}
|
|
7699
7884
|
};
|
|
7700
|
-
var
|
|
7885
|
+
var AggregatorClient30 = _AggregatorClient;
|
|
7701
7886
|
function findPythPriceIDs(routes) {
|
|
7702
7887
|
const priceIDs = /* @__PURE__ */ new Set();
|
|
7703
7888
|
for (const route of routes) {
|
|
@@ -7740,6 +7925,11 @@ function findPythPriceIDs(routes) {
|
|
|
7740
7925
|
priceIDs.add(path.extendedDetails.sevenkCoinBPriceSeed);
|
|
7741
7926
|
}
|
|
7742
7927
|
}
|
|
7928
|
+
if (path.provider === HAEDALHMMV2) {
|
|
7929
|
+
if (path.extendedDetails && path.extendedDetails.haedalHmmV2BasePriceSeed) {
|
|
7930
|
+
priceIDs.add(path.extendedDetails.haedalHmmV2BasePriceSeed);
|
|
7931
|
+
}
|
|
7932
|
+
}
|
|
7743
7933
|
}
|
|
7744
7934
|
}
|
|
7745
7935
|
return Array.from(priceIDs);
|
|
@@ -7769,13 +7959,13 @@ function parseRouterResponse(data, byAmountIn) {
|
|
|
7769
7959
|
routes: data.routes.map((route) => {
|
|
7770
7960
|
return {
|
|
7771
7961
|
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;
|
|
7962
|
+
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
7963
|
let version;
|
|
7774
7964
|
if (path.provider === AFTERMATH) {
|
|
7775
7965
|
version = path.extended_details.aftermath_pool_flatness === 0 ? "v2" : "v3";
|
|
7776
7966
|
}
|
|
7777
7967
|
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) {
|
|
7968
|
+
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
7969
|
extendedDetails = {
|
|
7780
7970
|
aftermathLpSupplyType: (_a = path.extended_details) == null ? void 0 : _a.aftermath_lp_supply_type,
|
|
7781
7971
|
turbosFeeType: (_b = path.extended_details) == null ? void 0 : _b.turbos_fee_type,
|
|
@@ -7811,7 +8001,8 @@ function parseRouterResponse(data, byAmountIn) {
|
|
|
7811
8001
|
sevenkCoinBPriceSeed: (_F = path.extended_details) == null ? void 0 : _F.sevenk_coin_b_price_seed,
|
|
7812
8002
|
sevenkCoinAOracleId: (_G = path.extended_details) == null ? void 0 : _G.sevenk_oracle_config_a,
|
|
7813
8003
|
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
|
|
8004
|
+
sevenkLPCapType: (_I = path.extended_details) == null ? void 0 : _I.sevenk_lp_cap_type,
|
|
8005
|
+
haedalHmmV2BasePriceSeed: (_J = path.extended_details) == null ? void 0 : _J.haedalhmmv2_base_price_seed
|
|
7815
8006
|
};
|
|
7816
8007
|
}
|
|
7817
8008
|
return {
|
|
@@ -7908,7 +8099,7 @@ function processEndpoint(endpoint) {
|
|
|
7908
8099
|
|
|
7909
8100
|
// src/api.ts
|
|
7910
8101
|
var import_bn7 = __toESM(require_bn());
|
|
7911
|
-
var SDK_VERSION =
|
|
8102
|
+
var SDK_VERSION = 1001600;
|
|
7912
8103
|
function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
|
|
7913
8104
|
return __async(this, null, function* () {
|
|
7914
8105
|
let response;
|
|
@@ -8098,10 +8289,10 @@ function getDeepbookV3Config(endpoint) {
|
|
|
8098
8289
|
}
|
|
8099
8290
|
|
|
8100
8291
|
// src/index.ts
|
|
8101
|
-
var Env = /* @__PURE__ */ ((
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
return
|
|
8292
|
+
var Env = /* @__PURE__ */ ((Env3) => {
|
|
8293
|
+
Env3[Env3["Mainnet"] = 0] = "Mainnet";
|
|
8294
|
+
Env3[Env3["Testnet"] = 1] = "Testnet";
|
|
8295
|
+
return Env3;
|
|
8105
8296
|
})(Env || {});
|
|
8106
8297
|
/*! Bundled license information:
|
|
8107
8298
|
|
|
@@ -8122,7 +8313,7 @@ exports.AGGREGATOR_V2_EXTEND = AGGREGATOR_V2_EXTEND;
|
|
|
8122
8313
|
exports.AGGREGATOR_V2_EXTEND2 = AGGREGATOR_V2_EXTEND2;
|
|
8123
8314
|
exports.ALL_DEXES = ALL_DEXES;
|
|
8124
8315
|
exports.ALPHAFI = ALPHAFI;
|
|
8125
|
-
exports.AggregatorClient =
|
|
8316
|
+
exports.AggregatorClient = AggregatorClient30;
|
|
8126
8317
|
exports.BLUEFIN = BLUEFIN;
|
|
8127
8318
|
exports.BLUEMOVE = BLUEMOVE;
|
|
8128
8319
|
exports.CETUS = CETUS;
|
|
@@ -8133,7 +8324,9 @@ exports.DEFAULT_ENDPOINT = DEFAULT_ENDPOINT;
|
|
|
8133
8324
|
exports.Env = Env;
|
|
8134
8325
|
exports.FLOWXV2 = FLOWXV2;
|
|
8135
8326
|
exports.FLOWXV3 = FLOWXV3;
|
|
8327
|
+
exports.FULLSAIL = FULLSAIL;
|
|
8136
8328
|
exports.HAEDAL = HAEDAL;
|
|
8329
|
+
exports.HAEDALHMMV2 = HAEDALHMMV2;
|
|
8137
8330
|
exports.HAEDALPMM = HAEDALPMM;
|
|
8138
8331
|
exports.HAWAL = HAWAL;
|
|
8139
8332
|
exports.KRIYA = KRIYA;
|