@cetusprotocol/aggregator-sdk 0.9.1 → 0.11.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.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +153 -21
- package/dist/index.mjs +152 -21
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -86,6 +86,7 @@ declare const OBRIC = "OBRIC";
|
|
|
86
86
|
declare const HAWAL = "HAWAL";
|
|
87
87
|
declare const STEAMM_OMM = "STEAMM_OMM";
|
|
88
88
|
declare const MOMENTUM = "MOMENTUM";
|
|
89
|
+
declare const STEAMM_OMM_V2 = "STEAMM_OMM_V2";
|
|
89
90
|
declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
90
91
|
type BuildRouterSwapParams = {
|
|
91
92
|
routers: Router[];
|
|
@@ -350,4 +351,4 @@ declare enum Env {
|
|
|
350
351
|
Testnet = 1
|
|
351
352
|
}
|
|
352
353
|
|
|
353
|
-
export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, 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, METASTABLE, MOMENTUM, OBRIC, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, SPRINGSUI, STEAMM, STEAMM_OMM, 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, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
|
|
354
|
+
export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, 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, METASTABLE, MOMENTUM, OBRIC, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, 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, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -86,6 +86,7 @@ declare const OBRIC = "OBRIC";
|
|
|
86
86
|
declare const HAWAL = "HAWAL";
|
|
87
87
|
declare const STEAMM_OMM = "STEAMM_OMM";
|
|
88
88
|
declare const MOMENTUM = "MOMENTUM";
|
|
89
|
+
declare const STEAMM_OMM_V2 = "STEAMM_OMM_V2";
|
|
89
90
|
declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
90
91
|
type BuildRouterSwapParams = {
|
|
91
92
|
routers: Router[];
|
|
@@ -350,4 +351,4 @@ declare enum Env {
|
|
|
350
351
|
Testnet = 1
|
|
351
352
|
}
|
|
352
353
|
|
|
353
|
-
export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, 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, METASTABLE, MOMENTUM, OBRIC, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, SPRINGSUI, STEAMM, STEAMM_OMM, 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, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
|
|
354
|
+
export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, 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, METASTABLE, MOMENTUM, OBRIC, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, 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, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
|
package/dist/index.js
CHANGED
|
@@ -6312,7 +6312,7 @@ var SteammCPMM = class {
|
|
|
6312
6312
|
var SteammOmm = class {
|
|
6313
6313
|
constructor(env, pythPriceIDs) {
|
|
6314
6314
|
if (env !== 0 /* Mainnet */) {
|
|
6315
|
-
throw new Error("Steamm only supported on mainnet");
|
|
6315
|
+
throw new Error("Steamm omm only supported on mainnet");
|
|
6316
6316
|
}
|
|
6317
6317
|
this.pythPriceIDs = pythPriceIDs;
|
|
6318
6318
|
this.oraclePackageId = "0xe84b649199654d18c38e727212f5d8dacfc3cf78d60d0a7fc85fd589f280eb2b";
|
|
@@ -6647,6 +6647,114 @@ var Momentum = class {
|
|
|
6647
6647
|
}
|
|
6648
6648
|
};
|
|
6649
6649
|
|
|
6650
|
+
// src/transaction/steamm_omm_v2.ts
|
|
6651
|
+
var SteammOmmV2 = class {
|
|
6652
|
+
constructor(env, pythPriceIDs) {
|
|
6653
|
+
if (env !== 0 /* Mainnet */) {
|
|
6654
|
+
throw new Error("Steamm omm v2 only supported on mainnet");
|
|
6655
|
+
}
|
|
6656
|
+
this.pythPriceIDs = pythPriceIDs;
|
|
6657
|
+
this.oraclePackageId = "0xe84b649199654d18c38e727212f5d8dacfc3cf78d60d0a7fc85fd589f280eb2b";
|
|
6658
|
+
}
|
|
6659
|
+
swap(client, txb, path, inputCoin, packages) {
|
|
6660
|
+
return __async(this, null, function* () {
|
|
6661
|
+
const { direction, from, target } = path;
|
|
6662
|
+
if (path.extendedDetails == null) {
|
|
6663
|
+
throw new Error("Extended details not supported");
|
|
6664
|
+
} else {
|
|
6665
|
+
if (path.extendedDetails.steammBankA == null) {
|
|
6666
|
+
throw new Error("Steamm bank a type not supported");
|
|
6667
|
+
}
|
|
6668
|
+
if (path.extendedDetails.steammBankB == null) {
|
|
6669
|
+
throw new Error("Steamm bank b type not supported");
|
|
6670
|
+
}
|
|
6671
|
+
if (path.extendedDetails.steammLendingMarket == null) {
|
|
6672
|
+
throw new Error("Steamm lending market not supported");
|
|
6673
|
+
}
|
|
6674
|
+
if (path.extendedDetails.steammLendingMarketType == null) {
|
|
6675
|
+
throw new Error("Steamm lending market type not supported");
|
|
6676
|
+
}
|
|
6677
|
+
if (path.extendedDetails.steammBCoinAType == null) {
|
|
6678
|
+
throw new Error("Steamm b coin a type not supported");
|
|
6679
|
+
}
|
|
6680
|
+
if (path.extendedDetails.steammBCoinBType == null) {
|
|
6681
|
+
throw new Error("Steamm b coin b type not supported");
|
|
6682
|
+
}
|
|
6683
|
+
if (path.extendedDetails.steammLPToken == null) {
|
|
6684
|
+
throw new Error("Steamm lp token not supported");
|
|
6685
|
+
}
|
|
6686
|
+
if (path.extendedDetails.steammOracleRegistryId == null) {
|
|
6687
|
+
throw new Error("Steamm oracle registry id not supported");
|
|
6688
|
+
}
|
|
6689
|
+
if (path.extendedDetails.steammOracleIndexA == null) {
|
|
6690
|
+
throw new Error("Steamm oracle index a not supported");
|
|
6691
|
+
}
|
|
6692
|
+
if (path.extendedDetails.steammOracleIndexB == null) {
|
|
6693
|
+
throw new Error("Steamm oracle index b not supported");
|
|
6694
|
+
}
|
|
6695
|
+
if (path.extendedDetails.steammOraclePythPriceSeedA == null) {
|
|
6696
|
+
throw new Error("Steamm oracle pyth price seed a not supported");
|
|
6697
|
+
}
|
|
6698
|
+
if (path.extendedDetails.steammOraclePythPriceSeedB == null) {
|
|
6699
|
+
throw new Error("Steamm oracle pyth price seed b not supported");
|
|
6700
|
+
}
|
|
6701
|
+
}
|
|
6702
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
6703
|
+
const priceSeedA = path.extendedDetails.steammOraclePythPriceSeedA;
|
|
6704
|
+
const priceSeedB = path.extendedDetails.steammOraclePythPriceSeedB;
|
|
6705
|
+
const priceInfoObjectIdA = this.pythPriceIDs.get(priceSeedA);
|
|
6706
|
+
const priceInfoObjectIdB = this.pythPriceIDs.get(priceSeedB);
|
|
6707
|
+
if (!priceInfoObjectIdA || !priceInfoObjectIdB) {
|
|
6708
|
+
throw new Error("Base price info object id or quote price info object id not found");
|
|
6709
|
+
}
|
|
6710
|
+
const oraclePriceUpdateA = txb.moveCall({
|
|
6711
|
+
target: `${this.oraclePackageId}::oracles::get_pyth_price`,
|
|
6712
|
+
typeArguments: [],
|
|
6713
|
+
arguments: [
|
|
6714
|
+
txb.object(path.extendedDetails.steammOracleRegistryId),
|
|
6715
|
+
txb.object(priceInfoObjectIdA),
|
|
6716
|
+
txb.pure.u64(path.extendedDetails.steammOracleIndexA),
|
|
6717
|
+
txb.object(CLOCK_ADDRESS)
|
|
6718
|
+
]
|
|
6719
|
+
});
|
|
6720
|
+
const oraclePriceUpdateB = txb.moveCall({
|
|
6721
|
+
target: `${this.oraclePackageId}::oracles::get_pyth_price`,
|
|
6722
|
+
typeArguments: [],
|
|
6723
|
+
arguments: [
|
|
6724
|
+
txb.object(path.extendedDetails.steammOracleRegistryId),
|
|
6725
|
+
txb.object(priceInfoObjectIdB),
|
|
6726
|
+
txb.pure.u64(path.extendedDetails.steammOracleIndexB),
|
|
6727
|
+
txb.object(CLOCK_ADDRESS)
|
|
6728
|
+
]
|
|
6729
|
+
});
|
|
6730
|
+
const args = [
|
|
6731
|
+
txb.object(path.id),
|
|
6732
|
+
txb.object(path.extendedDetails.steammBankA),
|
|
6733
|
+
txb.object(path.extendedDetails.steammBankB),
|
|
6734
|
+
txb.object(path.extendedDetails.steammLendingMarket),
|
|
6735
|
+
oraclePriceUpdateA,
|
|
6736
|
+
oraclePriceUpdateB,
|
|
6737
|
+
inputCoin,
|
|
6738
|
+
txb.object(CLOCK_ADDRESS)
|
|
6739
|
+
];
|
|
6740
|
+
const publishedAt = getAggregatorV2Extend2PublishedAt(client.publishedAtV2Extend2(), packages);
|
|
6741
|
+
const res = txb.moveCall({
|
|
6742
|
+
target: `${publishedAt}::steamm_omm_v2::${func}`,
|
|
6743
|
+
typeArguments: [
|
|
6744
|
+
path.extendedDetails.steammLendingMarketType,
|
|
6745
|
+
coinAType,
|
|
6746
|
+
coinBType,
|
|
6747
|
+
path.extendedDetails.steammBCoinAType,
|
|
6748
|
+
path.extendedDetails.steammBCoinBType,
|
|
6749
|
+
path.extendedDetails.steammLPToken
|
|
6750
|
+
],
|
|
6751
|
+
arguments: args
|
|
6752
|
+
});
|
|
6753
|
+
return res;
|
|
6754
|
+
});
|
|
6755
|
+
}
|
|
6756
|
+
};
|
|
6757
|
+
|
|
6650
6758
|
// src/client.ts
|
|
6651
6759
|
var CETUS = "CETUS";
|
|
6652
6760
|
var DEEPBOOKV2 = "DEEPBOOK";
|
|
@@ -6673,6 +6781,7 @@ var OBRIC = "OBRIC";
|
|
|
6673
6781
|
var HAWAL = "HAWAL";
|
|
6674
6782
|
var STEAMM_OMM = "STEAMM_OMM";
|
|
6675
6783
|
var MOMENTUM = "MOMENTUM";
|
|
6784
|
+
var STEAMM_OMM_V2 = "STEAMM_OMM_V2";
|
|
6676
6785
|
var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
6677
6786
|
function isBuilderRouterSwapParams(params) {
|
|
6678
6787
|
return Array.isArray(params.routers);
|
|
@@ -6712,7 +6821,9 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6712
6821
|
if (!pythUrls.includes("https://hermes.pyth.network")) {
|
|
6713
6822
|
pythUrls.push("https://hermes.pyth.network");
|
|
6714
6823
|
}
|
|
6715
|
-
const connections = pythUrls.map(
|
|
6824
|
+
const connections = pythUrls.map(
|
|
6825
|
+
(url) => new pythSuiJs.SuiPriceServiceConnection(url, { timeout: 3e3 })
|
|
6826
|
+
);
|
|
6716
6827
|
return connections;
|
|
6717
6828
|
}
|
|
6718
6829
|
getCoins(coinType, refresh = true) {
|
|
@@ -6759,7 +6870,13 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6759
6870
|
}
|
|
6760
6871
|
findRouters(params) {
|
|
6761
6872
|
return __async(this, null, function* () {
|
|
6762
|
-
return getRouterResult(
|
|
6873
|
+
return getRouterResult(
|
|
6874
|
+
this.endpoint,
|
|
6875
|
+
this.apiKey,
|
|
6876
|
+
params,
|
|
6877
|
+
this.overlayFeeRate,
|
|
6878
|
+
this.overlayFeeReceiver
|
|
6879
|
+
);
|
|
6763
6880
|
});
|
|
6764
6881
|
}
|
|
6765
6882
|
executeFlexibleInputSwap(txb, inputCoin, routers, expectedAmountOut, amountLimit, pythPriceIDs, partner, deepbookv3DeepFee, packages) {
|
|
@@ -6773,7 +6890,9 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6773
6890
|
if (routers[i].path.length === 0) {
|
|
6774
6891
|
throw new Error("Empty path");
|
|
6775
6892
|
}
|
|
6776
|
-
const splitCoin = txb.splitCoins(inputCoin, [
|
|
6893
|
+
const splitCoin = txb.splitCoins(inputCoin, [
|
|
6894
|
+
routers[i].amountIn.toString()
|
|
6895
|
+
]);
|
|
6777
6896
|
let nextCoin = splitCoin[0];
|
|
6778
6897
|
for (const path of routers[i].path) {
|
|
6779
6898
|
const dex = this.newDex(path.provider, pythPriceIDs, partner);
|
|
@@ -6950,7 +7069,9 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6950
7069
|
return __async(this, null, function* () {
|
|
6951
7070
|
const { routers, inputCoin, slippage, txb, deepbookv3DeepFee, partner } = params;
|
|
6952
7071
|
if (slippage > 1 || slippage < 0) {
|
|
6953
|
-
throw new Error(
|
|
7072
|
+
throw new Error(
|
|
7073
|
+
"Invalid slippage value. Must be between 0 and 1 (e.g., 0.01 represents 1% slippage)"
|
|
7074
|
+
);
|
|
6954
7075
|
}
|
|
6955
7076
|
const routerData = Array.isArray(routers) ? routers : routers.routes;
|
|
6956
7077
|
const byAmountIn = isBuilderRouterSwapParams(params) ? params.byAmountIn : params.routers.byAmountIn;
|
|
@@ -6999,9 +7120,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6999
7120
|
return targetCoin2;
|
|
7000
7121
|
}
|
|
7001
7122
|
if (this.overlayFeeRate > 0 && this.overlayFeeReceiver !== "0x0") {
|
|
7002
|
-
const overlayFeeCoin = txb.splitCoins(inputCoin, [
|
|
7003
|
-
overlayFee.toString()
|
|
7004
|
-
]);
|
|
7123
|
+
const overlayFeeCoin = txb.splitCoins(inputCoin, [overlayFee.toString()]);
|
|
7005
7124
|
txb.transferObjects([overlayFeeCoin], this.overlayFeeReceiver);
|
|
7006
7125
|
}
|
|
7007
7126
|
const splitedInputCoins = txb.splitCoins(inputCoin, [
|
|
@@ -7038,9 +7157,13 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7038
7157
|
let overlayFee = 0;
|
|
7039
7158
|
if (this.overlayFeeRate > 0 && this.overlayFeeReceiver !== "0x0") {
|
|
7040
7159
|
if (byAmountIn) {
|
|
7041
|
-
overlayFee = Number(
|
|
7160
|
+
overlayFee = Number(
|
|
7161
|
+
amountOut.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString()
|
|
7162
|
+
);
|
|
7042
7163
|
} else {
|
|
7043
|
-
overlayFee = Number(
|
|
7164
|
+
overlayFee = Number(
|
|
7165
|
+
amountIn.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString()
|
|
7166
|
+
);
|
|
7044
7167
|
}
|
|
7045
7168
|
}
|
|
7046
7169
|
const expectedAmountOut = byAmountIn ? amountOut.sub(new import_bn5.default(overlayFee)) : amountOut;
|
|
@@ -7104,9 +7227,13 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7104
7227
|
let overlayFee = 0;
|
|
7105
7228
|
if (this.overlayFeeRate > 0 && this.overlayFeeReceiver !== "0x0") {
|
|
7106
7229
|
if (byAmountIn) {
|
|
7107
|
-
overlayFee = Number(
|
|
7230
|
+
overlayFee = Number(
|
|
7231
|
+
amountOut.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString()
|
|
7232
|
+
);
|
|
7108
7233
|
} else {
|
|
7109
|
-
overlayFee = Number(
|
|
7234
|
+
overlayFee = Number(
|
|
7235
|
+
amountIn.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString()
|
|
7236
|
+
);
|
|
7110
7237
|
}
|
|
7111
7238
|
}
|
|
7112
7239
|
const expectedAmountOut = byAmountIn ? amountOut.sub(new import_bn5.default(overlayFee)) : amountOut;
|
|
@@ -7181,7 +7308,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7181
7308
|
// Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
|
|
7182
7309
|
publishedAtV2() {
|
|
7183
7310
|
if (this.env === 0 /* Mainnet */) {
|
|
7184
|
-
return "
|
|
7311
|
+
return "0x51966dc1d9d3e6d85aed55aa87eb9e78e928b4e74b4844a15ef7e3dfb5af3bae";
|
|
7185
7312
|
} else {
|
|
7186
7313
|
return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
|
|
7187
7314
|
}
|
|
@@ -7189,14 +7316,14 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7189
7316
|
// Include deepbookv3, scallop, bluefin
|
|
7190
7317
|
publishedAtV2Extend() {
|
|
7191
7318
|
if (this.env === 0 /* Mainnet */) {
|
|
7192
|
-
return "
|
|
7319
|
+
return "0x7cdd26c4aa40c990d5ca780e0919b2de796be9bb41fba461d133bfacb0f677bc";
|
|
7193
7320
|
} else {
|
|
7194
7321
|
return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
|
|
7195
7322
|
}
|
|
7196
7323
|
}
|
|
7197
7324
|
publishedAtV2Extend2() {
|
|
7198
7325
|
if (this.env === 0 /* Mainnet */) {
|
|
7199
|
-
return "
|
|
7326
|
+
return "0x186d6d71cedd341ad744e40873cc1513ac539ffac860d0c3ebd27ec5da63d9ba";
|
|
7200
7327
|
} else {
|
|
7201
7328
|
return "0x0";
|
|
7202
7329
|
}
|
|
@@ -7303,6 +7430,8 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7303
7430
|
return new HaWAL(this.env);
|
|
7304
7431
|
case MOMENTUM:
|
|
7305
7432
|
return new Momentum(this.env);
|
|
7433
|
+
case STEAMM_OMM_V2:
|
|
7434
|
+
return new SteammOmmV2(this.env, pythPriceIDs);
|
|
7306
7435
|
default:
|
|
7307
7436
|
throw new Error(`Unsupported dex ${provider}`);
|
|
7308
7437
|
}
|
|
@@ -7376,7 +7505,9 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7376
7505
|
priceIDs
|
|
7377
7506
|
);
|
|
7378
7507
|
} catch (e) {
|
|
7379
|
-
throw new Error(
|
|
7508
|
+
throw new Error(
|
|
7509
|
+
`All Pyth price nodes are unavailable. Cannot fetch price data. Please switch to or add new available Pyth nodes in the pythUrls parameter when initializing AggregatorClient, for example: new AggregatorClient({ pythUrls: ["https://your-pyth-node-url"] }). Detailed error: ${e}`
|
|
7510
|
+
);
|
|
7380
7511
|
}
|
|
7381
7512
|
let priceInfoObjectIdsMap = /* @__PURE__ */ new Map();
|
|
7382
7513
|
for (let i = 0; i < priceIDs.length; i++) {
|
|
@@ -7396,7 +7527,7 @@ _AggregatorClient.CONFIG = {
|
|
|
7396
7527
|
pythStateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"
|
|
7397
7528
|
}
|
|
7398
7529
|
};
|
|
7399
|
-
var
|
|
7530
|
+
var AggregatorClient26 = _AggregatorClient;
|
|
7400
7531
|
function findPythPriceIDs(routes) {
|
|
7401
7532
|
const priceIDs = /* @__PURE__ */ new Set();
|
|
7402
7533
|
for (const route of routes) {
|
|
@@ -7423,7 +7554,7 @@ function findPythPriceIDs(routes) {
|
|
|
7423
7554
|
priceIDs.add(path.extendedDetails.obricCoinBPriceSeed);
|
|
7424
7555
|
}
|
|
7425
7556
|
}
|
|
7426
|
-
if (path.provider === STEAMM_OMM) {
|
|
7557
|
+
if (path.provider === STEAMM_OMM || path.provider === STEAMM_OMM_V2) {
|
|
7427
7558
|
if (path.extendedDetails && path.extendedDetails.steammOraclePythPriceSeedA) {
|
|
7428
7559
|
priceIDs.add(path.extendedDetails.steammOraclePythPriceSeedA);
|
|
7429
7560
|
}
|
|
@@ -7465,7 +7596,7 @@ function parseRouterResponse(data, byAmountIn) {
|
|
|
7465
7596
|
version = path.extended_details.aftermath_pool_flatness === 0 ? "v2" : "v3";
|
|
7466
7597
|
}
|
|
7467
7598
|
let extendedDetails;
|
|
7468
|
-
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) {
|
|
7599
|
+
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) {
|
|
7469
7600
|
extendedDetails = {
|
|
7470
7601
|
aftermathLpSupplyType: (_a = path.extended_details) == null ? void 0 : _a.aftermath_lp_supply_type,
|
|
7471
7602
|
turbosFeeType: (_b = path.extended_details) == null ? void 0 : _b.turbos_fee_type,
|
|
@@ -7593,7 +7724,7 @@ function processEndpoint(endpoint) {
|
|
|
7593
7724
|
|
|
7594
7725
|
// src/api.ts
|
|
7595
7726
|
var import_bn7 = __toESM(require_bn());
|
|
7596
|
-
var SDK_VERSION =
|
|
7727
|
+
var SDK_VERSION = 1001100;
|
|
7597
7728
|
function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
|
|
7598
7729
|
return __async(this, null, function* () {
|
|
7599
7730
|
let response;
|
|
@@ -7803,7 +7934,7 @@ exports.AGGREGATOR_V2 = AGGREGATOR_V2;
|
|
|
7803
7934
|
exports.AGGREGATOR_V2_EXTEND = AGGREGATOR_V2_EXTEND;
|
|
7804
7935
|
exports.AGGREGATOR_V2_EXTEND2 = AGGREGATOR_V2_EXTEND2;
|
|
7805
7936
|
exports.ALPHAFI = ALPHAFI;
|
|
7806
|
-
exports.AggregatorClient =
|
|
7937
|
+
exports.AggregatorClient = AggregatorClient26;
|
|
7807
7938
|
exports.BLUEFIN = BLUEFIN;
|
|
7808
7939
|
exports.BLUEMOVE = BLUEMOVE;
|
|
7809
7940
|
exports.CETUS = CETUS;
|
|
@@ -7827,6 +7958,7 @@ exports.SCALLOP = SCALLOP;
|
|
|
7827
7958
|
exports.SPRINGSUI = SPRINGSUI;
|
|
7828
7959
|
exports.STEAMM = STEAMM;
|
|
7829
7960
|
exports.STEAMM_OMM = STEAMM_OMM;
|
|
7961
|
+
exports.STEAMM_OMM_V2 = STEAMM_OMM_V2;
|
|
7830
7962
|
exports.SUILEND = SUILEND;
|
|
7831
7963
|
exports.TEN_POW_NINE = TEN_POW_NINE;
|
|
7832
7964
|
exports.TURBOS = TURBOS;
|
package/dist/index.mjs
CHANGED
|
@@ -6310,7 +6310,7 @@ var SteammCPMM = class {
|
|
|
6310
6310
|
var SteammOmm = class {
|
|
6311
6311
|
constructor(env, pythPriceIDs) {
|
|
6312
6312
|
if (env !== 0 /* Mainnet */) {
|
|
6313
|
-
throw new Error("Steamm only supported on mainnet");
|
|
6313
|
+
throw new Error("Steamm omm only supported on mainnet");
|
|
6314
6314
|
}
|
|
6315
6315
|
this.pythPriceIDs = pythPriceIDs;
|
|
6316
6316
|
this.oraclePackageId = "0xe84b649199654d18c38e727212f5d8dacfc3cf78d60d0a7fc85fd589f280eb2b";
|
|
@@ -6645,6 +6645,114 @@ var Momentum = class {
|
|
|
6645
6645
|
}
|
|
6646
6646
|
};
|
|
6647
6647
|
|
|
6648
|
+
// src/transaction/steamm_omm_v2.ts
|
|
6649
|
+
var SteammOmmV2 = class {
|
|
6650
|
+
constructor(env, pythPriceIDs) {
|
|
6651
|
+
if (env !== 0 /* Mainnet */) {
|
|
6652
|
+
throw new Error("Steamm omm v2 only supported on mainnet");
|
|
6653
|
+
}
|
|
6654
|
+
this.pythPriceIDs = pythPriceIDs;
|
|
6655
|
+
this.oraclePackageId = "0xe84b649199654d18c38e727212f5d8dacfc3cf78d60d0a7fc85fd589f280eb2b";
|
|
6656
|
+
}
|
|
6657
|
+
swap(client, txb, path, inputCoin, packages) {
|
|
6658
|
+
return __async(this, null, function* () {
|
|
6659
|
+
const { direction, from, target } = path;
|
|
6660
|
+
if (path.extendedDetails == null) {
|
|
6661
|
+
throw new Error("Extended details not supported");
|
|
6662
|
+
} else {
|
|
6663
|
+
if (path.extendedDetails.steammBankA == null) {
|
|
6664
|
+
throw new Error("Steamm bank a type not supported");
|
|
6665
|
+
}
|
|
6666
|
+
if (path.extendedDetails.steammBankB == null) {
|
|
6667
|
+
throw new Error("Steamm bank b type not supported");
|
|
6668
|
+
}
|
|
6669
|
+
if (path.extendedDetails.steammLendingMarket == null) {
|
|
6670
|
+
throw new Error("Steamm lending market not supported");
|
|
6671
|
+
}
|
|
6672
|
+
if (path.extendedDetails.steammLendingMarketType == null) {
|
|
6673
|
+
throw new Error("Steamm lending market type not supported");
|
|
6674
|
+
}
|
|
6675
|
+
if (path.extendedDetails.steammBCoinAType == null) {
|
|
6676
|
+
throw new Error("Steamm b coin a type not supported");
|
|
6677
|
+
}
|
|
6678
|
+
if (path.extendedDetails.steammBCoinBType == null) {
|
|
6679
|
+
throw new Error("Steamm b coin b type not supported");
|
|
6680
|
+
}
|
|
6681
|
+
if (path.extendedDetails.steammLPToken == null) {
|
|
6682
|
+
throw new Error("Steamm lp token not supported");
|
|
6683
|
+
}
|
|
6684
|
+
if (path.extendedDetails.steammOracleRegistryId == null) {
|
|
6685
|
+
throw new Error("Steamm oracle registry id not supported");
|
|
6686
|
+
}
|
|
6687
|
+
if (path.extendedDetails.steammOracleIndexA == null) {
|
|
6688
|
+
throw new Error("Steamm oracle index a not supported");
|
|
6689
|
+
}
|
|
6690
|
+
if (path.extendedDetails.steammOracleIndexB == null) {
|
|
6691
|
+
throw new Error("Steamm oracle index b not supported");
|
|
6692
|
+
}
|
|
6693
|
+
if (path.extendedDetails.steammOraclePythPriceSeedA == null) {
|
|
6694
|
+
throw new Error("Steamm oracle pyth price seed a not supported");
|
|
6695
|
+
}
|
|
6696
|
+
if (path.extendedDetails.steammOraclePythPriceSeedB == null) {
|
|
6697
|
+
throw new Error("Steamm oracle pyth price seed b not supported");
|
|
6698
|
+
}
|
|
6699
|
+
}
|
|
6700
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
6701
|
+
const priceSeedA = path.extendedDetails.steammOraclePythPriceSeedA;
|
|
6702
|
+
const priceSeedB = path.extendedDetails.steammOraclePythPriceSeedB;
|
|
6703
|
+
const priceInfoObjectIdA = this.pythPriceIDs.get(priceSeedA);
|
|
6704
|
+
const priceInfoObjectIdB = this.pythPriceIDs.get(priceSeedB);
|
|
6705
|
+
if (!priceInfoObjectIdA || !priceInfoObjectIdB) {
|
|
6706
|
+
throw new Error("Base price info object id or quote price info object id not found");
|
|
6707
|
+
}
|
|
6708
|
+
const oraclePriceUpdateA = txb.moveCall({
|
|
6709
|
+
target: `${this.oraclePackageId}::oracles::get_pyth_price`,
|
|
6710
|
+
typeArguments: [],
|
|
6711
|
+
arguments: [
|
|
6712
|
+
txb.object(path.extendedDetails.steammOracleRegistryId),
|
|
6713
|
+
txb.object(priceInfoObjectIdA),
|
|
6714
|
+
txb.pure.u64(path.extendedDetails.steammOracleIndexA),
|
|
6715
|
+
txb.object(CLOCK_ADDRESS)
|
|
6716
|
+
]
|
|
6717
|
+
});
|
|
6718
|
+
const oraclePriceUpdateB = txb.moveCall({
|
|
6719
|
+
target: `${this.oraclePackageId}::oracles::get_pyth_price`,
|
|
6720
|
+
typeArguments: [],
|
|
6721
|
+
arguments: [
|
|
6722
|
+
txb.object(path.extendedDetails.steammOracleRegistryId),
|
|
6723
|
+
txb.object(priceInfoObjectIdB),
|
|
6724
|
+
txb.pure.u64(path.extendedDetails.steammOracleIndexB),
|
|
6725
|
+
txb.object(CLOCK_ADDRESS)
|
|
6726
|
+
]
|
|
6727
|
+
});
|
|
6728
|
+
const args = [
|
|
6729
|
+
txb.object(path.id),
|
|
6730
|
+
txb.object(path.extendedDetails.steammBankA),
|
|
6731
|
+
txb.object(path.extendedDetails.steammBankB),
|
|
6732
|
+
txb.object(path.extendedDetails.steammLendingMarket),
|
|
6733
|
+
oraclePriceUpdateA,
|
|
6734
|
+
oraclePriceUpdateB,
|
|
6735
|
+
inputCoin,
|
|
6736
|
+
txb.object(CLOCK_ADDRESS)
|
|
6737
|
+
];
|
|
6738
|
+
const publishedAt = getAggregatorV2Extend2PublishedAt(client.publishedAtV2Extend2(), packages);
|
|
6739
|
+
const res = txb.moveCall({
|
|
6740
|
+
target: `${publishedAt}::steamm_omm_v2::${func}`,
|
|
6741
|
+
typeArguments: [
|
|
6742
|
+
path.extendedDetails.steammLendingMarketType,
|
|
6743
|
+
coinAType,
|
|
6744
|
+
coinBType,
|
|
6745
|
+
path.extendedDetails.steammBCoinAType,
|
|
6746
|
+
path.extendedDetails.steammBCoinBType,
|
|
6747
|
+
path.extendedDetails.steammLPToken
|
|
6748
|
+
],
|
|
6749
|
+
arguments: args
|
|
6750
|
+
});
|
|
6751
|
+
return res;
|
|
6752
|
+
});
|
|
6753
|
+
}
|
|
6754
|
+
};
|
|
6755
|
+
|
|
6648
6756
|
// src/client.ts
|
|
6649
6757
|
var CETUS = "CETUS";
|
|
6650
6758
|
var DEEPBOOKV2 = "DEEPBOOK";
|
|
@@ -6671,6 +6779,7 @@ var OBRIC = "OBRIC";
|
|
|
6671
6779
|
var HAWAL = "HAWAL";
|
|
6672
6780
|
var STEAMM_OMM = "STEAMM_OMM";
|
|
6673
6781
|
var MOMENTUM = "MOMENTUM";
|
|
6782
|
+
var STEAMM_OMM_V2 = "STEAMM_OMM_V2";
|
|
6674
6783
|
var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
6675
6784
|
function isBuilderRouterSwapParams(params) {
|
|
6676
6785
|
return Array.isArray(params.routers);
|
|
@@ -6710,7 +6819,9 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6710
6819
|
if (!pythUrls.includes("https://hermes.pyth.network")) {
|
|
6711
6820
|
pythUrls.push("https://hermes.pyth.network");
|
|
6712
6821
|
}
|
|
6713
|
-
const connections = pythUrls.map(
|
|
6822
|
+
const connections = pythUrls.map(
|
|
6823
|
+
(url) => new SuiPriceServiceConnection(url, { timeout: 3e3 })
|
|
6824
|
+
);
|
|
6714
6825
|
return connections;
|
|
6715
6826
|
}
|
|
6716
6827
|
getCoins(coinType, refresh = true) {
|
|
@@ -6757,7 +6868,13 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6757
6868
|
}
|
|
6758
6869
|
findRouters(params) {
|
|
6759
6870
|
return __async(this, null, function* () {
|
|
6760
|
-
return getRouterResult(
|
|
6871
|
+
return getRouterResult(
|
|
6872
|
+
this.endpoint,
|
|
6873
|
+
this.apiKey,
|
|
6874
|
+
params,
|
|
6875
|
+
this.overlayFeeRate,
|
|
6876
|
+
this.overlayFeeReceiver
|
|
6877
|
+
);
|
|
6761
6878
|
});
|
|
6762
6879
|
}
|
|
6763
6880
|
executeFlexibleInputSwap(txb, inputCoin, routers, expectedAmountOut, amountLimit, pythPriceIDs, partner, deepbookv3DeepFee, packages) {
|
|
@@ -6771,7 +6888,9 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6771
6888
|
if (routers[i].path.length === 0) {
|
|
6772
6889
|
throw new Error("Empty path");
|
|
6773
6890
|
}
|
|
6774
|
-
const splitCoin = txb.splitCoins(inputCoin, [
|
|
6891
|
+
const splitCoin = txb.splitCoins(inputCoin, [
|
|
6892
|
+
routers[i].amountIn.toString()
|
|
6893
|
+
]);
|
|
6775
6894
|
let nextCoin = splitCoin[0];
|
|
6776
6895
|
for (const path of routers[i].path) {
|
|
6777
6896
|
const dex = this.newDex(path.provider, pythPriceIDs, partner);
|
|
@@ -6948,7 +7067,9 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6948
7067
|
return __async(this, null, function* () {
|
|
6949
7068
|
const { routers, inputCoin, slippage, txb, deepbookv3DeepFee, partner } = params;
|
|
6950
7069
|
if (slippage > 1 || slippage < 0) {
|
|
6951
|
-
throw new Error(
|
|
7070
|
+
throw new Error(
|
|
7071
|
+
"Invalid slippage value. Must be between 0 and 1 (e.g., 0.01 represents 1% slippage)"
|
|
7072
|
+
);
|
|
6952
7073
|
}
|
|
6953
7074
|
const routerData = Array.isArray(routers) ? routers : routers.routes;
|
|
6954
7075
|
const byAmountIn = isBuilderRouterSwapParams(params) ? params.byAmountIn : params.routers.byAmountIn;
|
|
@@ -6997,9 +7118,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6997
7118
|
return targetCoin2;
|
|
6998
7119
|
}
|
|
6999
7120
|
if (this.overlayFeeRate > 0 && this.overlayFeeReceiver !== "0x0") {
|
|
7000
|
-
const overlayFeeCoin = txb.splitCoins(inputCoin, [
|
|
7001
|
-
overlayFee.toString()
|
|
7002
|
-
]);
|
|
7121
|
+
const overlayFeeCoin = txb.splitCoins(inputCoin, [overlayFee.toString()]);
|
|
7003
7122
|
txb.transferObjects([overlayFeeCoin], this.overlayFeeReceiver);
|
|
7004
7123
|
}
|
|
7005
7124
|
const splitedInputCoins = txb.splitCoins(inputCoin, [
|
|
@@ -7036,9 +7155,13 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7036
7155
|
let overlayFee = 0;
|
|
7037
7156
|
if (this.overlayFeeRate > 0 && this.overlayFeeReceiver !== "0x0") {
|
|
7038
7157
|
if (byAmountIn) {
|
|
7039
|
-
overlayFee = Number(
|
|
7158
|
+
overlayFee = Number(
|
|
7159
|
+
amountOut.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString()
|
|
7160
|
+
);
|
|
7040
7161
|
} else {
|
|
7041
|
-
overlayFee = Number(
|
|
7162
|
+
overlayFee = Number(
|
|
7163
|
+
amountIn.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString()
|
|
7164
|
+
);
|
|
7042
7165
|
}
|
|
7043
7166
|
}
|
|
7044
7167
|
const expectedAmountOut = byAmountIn ? amountOut.sub(new import_bn5.default(overlayFee)) : amountOut;
|
|
@@ -7102,9 +7225,13 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7102
7225
|
let overlayFee = 0;
|
|
7103
7226
|
if (this.overlayFeeRate > 0 && this.overlayFeeReceiver !== "0x0") {
|
|
7104
7227
|
if (byAmountIn) {
|
|
7105
|
-
overlayFee = Number(
|
|
7228
|
+
overlayFee = Number(
|
|
7229
|
+
amountOut.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString()
|
|
7230
|
+
);
|
|
7106
7231
|
} else {
|
|
7107
|
-
overlayFee = Number(
|
|
7232
|
+
overlayFee = Number(
|
|
7233
|
+
amountIn.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString()
|
|
7234
|
+
);
|
|
7108
7235
|
}
|
|
7109
7236
|
}
|
|
7110
7237
|
const expectedAmountOut = byAmountIn ? amountOut.sub(new import_bn5.default(overlayFee)) : amountOut;
|
|
@@ -7179,7 +7306,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7179
7306
|
// Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
|
|
7180
7307
|
publishedAtV2() {
|
|
7181
7308
|
if (this.env === 0 /* Mainnet */) {
|
|
7182
|
-
return "
|
|
7309
|
+
return "0x51966dc1d9d3e6d85aed55aa87eb9e78e928b4e74b4844a15ef7e3dfb5af3bae";
|
|
7183
7310
|
} else {
|
|
7184
7311
|
return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
|
|
7185
7312
|
}
|
|
@@ -7187,14 +7314,14 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7187
7314
|
// Include deepbookv3, scallop, bluefin
|
|
7188
7315
|
publishedAtV2Extend() {
|
|
7189
7316
|
if (this.env === 0 /* Mainnet */) {
|
|
7190
|
-
return "
|
|
7317
|
+
return "0x7cdd26c4aa40c990d5ca780e0919b2de796be9bb41fba461d133bfacb0f677bc";
|
|
7191
7318
|
} else {
|
|
7192
7319
|
return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
|
|
7193
7320
|
}
|
|
7194
7321
|
}
|
|
7195
7322
|
publishedAtV2Extend2() {
|
|
7196
7323
|
if (this.env === 0 /* Mainnet */) {
|
|
7197
|
-
return "
|
|
7324
|
+
return "0x186d6d71cedd341ad744e40873cc1513ac539ffac860d0c3ebd27ec5da63d9ba";
|
|
7198
7325
|
} else {
|
|
7199
7326
|
return "0x0";
|
|
7200
7327
|
}
|
|
@@ -7301,6 +7428,8 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7301
7428
|
return new HaWAL(this.env);
|
|
7302
7429
|
case MOMENTUM:
|
|
7303
7430
|
return new Momentum(this.env);
|
|
7431
|
+
case STEAMM_OMM_V2:
|
|
7432
|
+
return new SteammOmmV2(this.env, pythPriceIDs);
|
|
7304
7433
|
default:
|
|
7305
7434
|
throw new Error(`Unsupported dex ${provider}`);
|
|
7306
7435
|
}
|
|
@@ -7374,7 +7503,9 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7374
7503
|
priceIDs
|
|
7375
7504
|
);
|
|
7376
7505
|
} catch (e) {
|
|
7377
|
-
throw new Error(
|
|
7506
|
+
throw new Error(
|
|
7507
|
+
`All Pyth price nodes are unavailable. Cannot fetch price data. Please switch to or add new available Pyth nodes in the pythUrls parameter when initializing AggregatorClient, for example: new AggregatorClient({ pythUrls: ["https://your-pyth-node-url"] }). Detailed error: ${e}`
|
|
7508
|
+
);
|
|
7378
7509
|
}
|
|
7379
7510
|
let priceInfoObjectIdsMap = /* @__PURE__ */ new Map();
|
|
7380
7511
|
for (let i = 0; i < priceIDs.length; i++) {
|
|
@@ -7394,7 +7525,7 @@ _AggregatorClient.CONFIG = {
|
|
|
7394
7525
|
pythStateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"
|
|
7395
7526
|
}
|
|
7396
7527
|
};
|
|
7397
|
-
var
|
|
7528
|
+
var AggregatorClient26 = _AggregatorClient;
|
|
7398
7529
|
function findPythPriceIDs(routes) {
|
|
7399
7530
|
const priceIDs = /* @__PURE__ */ new Set();
|
|
7400
7531
|
for (const route of routes) {
|
|
@@ -7421,7 +7552,7 @@ function findPythPriceIDs(routes) {
|
|
|
7421
7552
|
priceIDs.add(path.extendedDetails.obricCoinBPriceSeed);
|
|
7422
7553
|
}
|
|
7423
7554
|
}
|
|
7424
|
-
if (path.provider === STEAMM_OMM) {
|
|
7555
|
+
if (path.provider === STEAMM_OMM || path.provider === STEAMM_OMM_V2) {
|
|
7425
7556
|
if (path.extendedDetails && path.extendedDetails.steammOraclePythPriceSeedA) {
|
|
7426
7557
|
priceIDs.add(path.extendedDetails.steammOraclePythPriceSeedA);
|
|
7427
7558
|
}
|
|
@@ -7463,7 +7594,7 @@ function parseRouterResponse(data, byAmountIn) {
|
|
|
7463
7594
|
version = path.extended_details.aftermath_pool_flatness === 0 ? "v2" : "v3";
|
|
7464
7595
|
}
|
|
7465
7596
|
let extendedDetails;
|
|
7466
|
-
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) {
|
|
7597
|
+
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) {
|
|
7467
7598
|
extendedDetails = {
|
|
7468
7599
|
aftermathLpSupplyType: (_a = path.extended_details) == null ? void 0 : _a.aftermath_lp_supply_type,
|
|
7469
7600
|
turbosFeeType: (_b = path.extended_details) == null ? void 0 : _b.turbos_fee_type,
|
|
@@ -7591,7 +7722,7 @@ function processEndpoint(endpoint) {
|
|
|
7591
7722
|
|
|
7592
7723
|
// src/api.ts
|
|
7593
7724
|
var import_bn7 = __toESM(require_bn());
|
|
7594
|
-
var SDK_VERSION =
|
|
7725
|
+
var SDK_VERSION = 1001100;
|
|
7595
7726
|
function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
|
|
7596
7727
|
return __async(this, null, function* () {
|
|
7597
7728
|
let response;
|
|
@@ -7795,4 +7926,4 @@ decimal.js/decimal.mjs:
|
|
|
7795
7926
|
*)
|
|
7796
7927
|
*/
|
|
7797
7928
|
|
|
7798
|
-
export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALPHAFI,
|
|
7929
|
+
export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALPHAFI, AggregatorClient26 as AggregatorClient, BLUEFIN, BLUEMOVE, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, Env, FLOWXV2, FLOWXV3, HAEDAL, HAEDALPMM, HAWAL, KRIYA, KRIYAV3, METASTABLE, MOMENTUM, OBRIC, ONE, SCALLOP, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, 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, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
|