@cetusprotocol/aggregator-sdk 0.12.0 → 0.13.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 +45 -9
- package/dist/index.mjs +44 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -87,6 +87,7 @@ declare const HAWAL = "HAWAL";
|
|
|
87
87
|
declare const STEAMM_OMM = "STEAMM_OMM";
|
|
88
88
|
declare const MOMENTUM = "MOMENTUM";
|
|
89
89
|
declare const STEAMM_OMM_V2 = "STEAMM_OMM_V2";
|
|
90
|
+
declare const MAGMA = "MAGMA";
|
|
90
91
|
declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
91
92
|
declare const ALL_DEXES: string[];
|
|
92
93
|
type BuildRouterSwapParams = {
|
|
@@ -365,4 +366,4 @@ declare enum Env {
|
|
|
365
366
|
Testnet = 1
|
|
366
367
|
}
|
|
367
368
|
|
|
368
|
-
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, 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, getAllProviders, getDeepbookV3Config, getProvidersExcluding, getProvidersIncluding, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
|
|
369
|
+
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, 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
|
@@ -87,6 +87,7 @@ declare const HAWAL = "HAWAL";
|
|
|
87
87
|
declare const STEAMM_OMM = "STEAMM_OMM";
|
|
88
88
|
declare const MOMENTUM = "MOMENTUM";
|
|
89
89
|
declare const STEAMM_OMM_V2 = "STEAMM_OMM_V2";
|
|
90
|
+
declare const MAGMA = "MAGMA";
|
|
90
91
|
declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
91
92
|
declare const ALL_DEXES: string[];
|
|
92
93
|
type BuildRouterSwapParams = {
|
|
@@ -365,4 +366,4 @@ declare enum Env {
|
|
|
365
366
|
Testnet = 1
|
|
366
367
|
}
|
|
367
368
|
|
|
368
|
-
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, 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, getAllProviders, getDeepbookV3Config, getProvidersExcluding, getProvidersIncluding, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
|
|
369
|
+
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, 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
|
@@ -5274,15 +5274,14 @@ var Cetus = class {
|
|
|
5274
5274
|
this.globalConfig = env === 0 /* Mainnet */ ? "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f" : "0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e";
|
|
5275
5275
|
this.partner = partner != null ? partner : env === 0 /* Mainnet */ ? "0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b" : "0x1f5fa5c820f40d43fc47815ad06d95e40a1942ff72a732a92e8ef4aa8cde70a5";
|
|
5276
5276
|
}
|
|
5277
|
-
flash_swap(client, txb, path, by_amount_in, packages) {
|
|
5277
|
+
flash_swap(client, txb, path, amount_arg, by_amount_in, packages) {
|
|
5278
5278
|
const { direction, from, target } = path;
|
|
5279
5279
|
const [func, coinAType, coinBType] = direction ? ["flash_swap_a2b", from, target] : ["flash_swap_b2a", target, from];
|
|
5280
|
-
let amount = by_amount_in ? path.amountIn : path.amountOut;
|
|
5281
5280
|
const args = [
|
|
5282
5281
|
txb.object(this.globalConfig),
|
|
5283
5282
|
txb.object(path.id),
|
|
5284
5283
|
txb.object(this.partner),
|
|
5285
|
-
|
|
5284
|
+
amount_arg,
|
|
5286
5285
|
txb.pure.bool(by_amount_in),
|
|
5287
5286
|
txb.object(CLOCK_ADDRESS)
|
|
5288
5287
|
];
|
|
@@ -6755,6 +6754,35 @@ var SteammOmmV2 = class {
|
|
|
6755
6754
|
}
|
|
6756
6755
|
};
|
|
6757
6756
|
|
|
6757
|
+
// src/transaction/magma.ts
|
|
6758
|
+
var Magma = class {
|
|
6759
|
+
constructor(env) {
|
|
6760
|
+
if (env !== 0 /* Mainnet */) {
|
|
6761
|
+
throw new Error("Magma CLMM only supported on mainnet");
|
|
6762
|
+
}
|
|
6763
|
+
this.globalConfig = "0x4c4e1402401f72c7d8533d0ed8d5f8949da363c7a3319ccef261ffe153d32f8a";
|
|
6764
|
+
}
|
|
6765
|
+
swap(client, txb, path, inputCoin, packages) {
|
|
6766
|
+
return __async(this, null, function* () {
|
|
6767
|
+
const { direction, from, target } = path;
|
|
6768
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
6769
|
+
const args = [
|
|
6770
|
+
txb.object(this.globalConfig),
|
|
6771
|
+
txb.object(path.id),
|
|
6772
|
+
inputCoin,
|
|
6773
|
+
txb.object(CLOCK_ADDRESS)
|
|
6774
|
+
];
|
|
6775
|
+
const publishedAt = getAggregatorV2Extend2PublishedAt(client.publishedAtV2Extend2(), packages);
|
|
6776
|
+
const res = txb.moveCall({
|
|
6777
|
+
target: `${publishedAt}::magma::${func}`,
|
|
6778
|
+
typeArguments: [coinAType, coinBType],
|
|
6779
|
+
arguments: args
|
|
6780
|
+
});
|
|
6781
|
+
return res;
|
|
6782
|
+
});
|
|
6783
|
+
}
|
|
6784
|
+
};
|
|
6785
|
+
|
|
6758
6786
|
// src/client.ts
|
|
6759
6787
|
var CETUS = "CETUS";
|
|
6760
6788
|
var DEEPBOOKV2 = "DEEPBOOK";
|
|
@@ -6782,6 +6810,7 @@ var HAWAL = "HAWAL";
|
|
|
6782
6810
|
var STEAMM_OMM = "STEAMM_OMM";
|
|
6783
6811
|
var MOMENTUM = "MOMENTUM";
|
|
6784
6812
|
var STEAMM_OMM_V2 = "STEAMM_OMM_V2";
|
|
6813
|
+
var MAGMA = "MAGMA";
|
|
6785
6814
|
var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
6786
6815
|
var ALL_DEXES = [
|
|
6787
6816
|
CETUS,
|
|
@@ -6808,7 +6837,8 @@ var ALL_DEXES = [
|
|
|
6808
6837
|
HAWAL,
|
|
6809
6838
|
MOMENTUM,
|
|
6810
6839
|
STEAMM_OMM,
|
|
6811
|
-
STEAMM_OMM_V2
|
|
6840
|
+
STEAMM_OMM_V2,
|
|
6841
|
+
MAGMA
|
|
6812
6842
|
];
|
|
6813
6843
|
function isBuilderRouterSwapParams(params) {
|
|
6814
6844
|
return Array.isArray(params.routers);
|
|
@@ -7039,9 +7069,11 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7039
7069
|
);
|
|
7040
7070
|
for (let i = 0; i < routers.length; i++) {
|
|
7041
7071
|
const router = routers[i];
|
|
7072
|
+
let amount_arg = txb.pure.u64(router.amountOut.toString());
|
|
7042
7073
|
for (let j = router.path.length - 1; j >= 0; j--) {
|
|
7043
7074
|
const path = router.path[j];
|
|
7044
|
-
const flashSwapResult = dex.flash_swap(this, txb, path, false);
|
|
7075
|
+
const flashSwapResult = dex.flash_swap(this, txb, path, amount_arg, false);
|
|
7076
|
+
amount_arg = flashSwapResult.payAmount;
|
|
7045
7077
|
returnCoins.unshift(flashSwapResult.targetCoin);
|
|
7046
7078
|
receipts.unshift(flashSwapResult.flashReceipt);
|
|
7047
7079
|
}
|
|
@@ -7279,6 +7311,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7279
7311
|
byAmountIn,
|
|
7280
7312
|
slippage
|
|
7281
7313
|
);
|
|
7314
|
+
console.log("amountLimit", amountLimit.toString());
|
|
7282
7315
|
const amount = byAmountIn ? expectedAmountIn : amountLimit;
|
|
7283
7316
|
const buildFromCoinRes = buildInputCoin(
|
|
7284
7317
|
txb,
|
|
@@ -7359,7 +7392,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7359
7392
|
}
|
|
7360
7393
|
publishedAtV2Extend2() {
|
|
7361
7394
|
if (this.env === 0 /* Mainnet */) {
|
|
7362
|
-
return "
|
|
7395
|
+
return "0xc40b43f0aa4ba5a4d71e39770265d3698d0e6dcfd846b7d7c443207f4e919e04";
|
|
7363
7396
|
} else {
|
|
7364
7397
|
return "0x0";
|
|
7365
7398
|
}
|
|
@@ -7468,6 +7501,8 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7468
7501
|
return new Momentum(this.env);
|
|
7469
7502
|
case STEAMM_OMM_V2:
|
|
7470
7503
|
return new SteammOmmV2(this.env, pythPriceIDs);
|
|
7504
|
+
case MAGMA:
|
|
7505
|
+
return new Magma(this.env);
|
|
7471
7506
|
default:
|
|
7472
7507
|
throw new Error(`Unsupported dex ${provider}`);
|
|
7473
7508
|
}
|
|
@@ -7563,7 +7598,7 @@ _AggregatorClient.CONFIG = {
|
|
|
7563
7598
|
pythStateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"
|
|
7564
7599
|
}
|
|
7565
7600
|
};
|
|
7566
|
-
var
|
|
7601
|
+
var AggregatorClient27 = _AggregatorClient;
|
|
7567
7602
|
function findPythPriceIDs(routes) {
|
|
7568
7603
|
const priceIDs = /* @__PURE__ */ new Set();
|
|
7569
7604
|
for (const route of routes) {
|
|
@@ -7760,7 +7795,7 @@ function processEndpoint(endpoint) {
|
|
|
7760
7795
|
|
|
7761
7796
|
// src/api.ts
|
|
7762
7797
|
var import_bn7 = __toESM(require_bn());
|
|
7763
|
-
var SDK_VERSION =
|
|
7798
|
+
var SDK_VERSION = 1001300;
|
|
7764
7799
|
function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
|
|
7765
7800
|
return __async(this, null, function* () {
|
|
7766
7801
|
let response;
|
|
@@ -7971,7 +8006,7 @@ exports.AGGREGATOR_V2_EXTEND = AGGREGATOR_V2_EXTEND;
|
|
|
7971
8006
|
exports.AGGREGATOR_V2_EXTEND2 = AGGREGATOR_V2_EXTEND2;
|
|
7972
8007
|
exports.ALL_DEXES = ALL_DEXES;
|
|
7973
8008
|
exports.ALPHAFI = ALPHAFI;
|
|
7974
|
-
exports.AggregatorClient =
|
|
8009
|
+
exports.AggregatorClient = AggregatorClient27;
|
|
7975
8010
|
exports.BLUEFIN = BLUEFIN;
|
|
7976
8011
|
exports.BLUEMOVE = BLUEMOVE;
|
|
7977
8012
|
exports.CETUS = CETUS;
|
|
@@ -7987,6 +8022,7 @@ exports.HAEDALPMM = HAEDALPMM;
|
|
|
7987
8022
|
exports.HAWAL = HAWAL;
|
|
7988
8023
|
exports.KRIYA = KRIYA;
|
|
7989
8024
|
exports.KRIYAV3 = KRIYAV3;
|
|
8025
|
+
exports.MAGMA = MAGMA;
|
|
7990
8026
|
exports.METASTABLE = METASTABLE;
|
|
7991
8027
|
exports.MOMENTUM = MOMENTUM;
|
|
7992
8028
|
exports.OBRIC = OBRIC;
|
package/dist/index.mjs
CHANGED
|
@@ -5272,15 +5272,14 @@ var Cetus = class {
|
|
|
5272
5272
|
this.globalConfig = env === 0 /* Mainnet */ ? "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f" : "0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e";
|
|
5273
5273
|
this.partner = partner != null ? partner : env === 0 /* Mainnet */ ? "0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b" : "0x1f5fa5c820f40d43fc47815ad06d95e40a1942ff72a732a92e8ef4aa8cde70a5";
|
|
5274
5274
|
}
|
|
5275
|
-
flash_swap(client, txb, path, by_amount_in, packages) {
|
|
5275
|
+
flash_swap(client, txb, path, amount_arg, by_amount_in, packages) {
|
|
5276
5276
|
const { direction, from, target } = path;
|
|
5277
5277
|
const [func, coinAType, coinBType] = direction ? ["flash_swap_a2b", from, target] : ["flash_swap_b2a", target, from];
|
|
5278
|
-
let amount = by_amount_in ? path.amountIn : path.amountOut;
|
|
5279
5278
|
const args = [
|
|
5280
5279
|
txb.object(this.globalConfig),
|
|
5281
5280
|
txb.object(path.id),
|
|
5282
5281
|
txb.object(this.partner),
|
|
5283
|
-
|
|
5282
|
+
amount_arg,
|
|
5284
5283
|
txb.pure.bool(by_amount_in),
|
|
5285
5284
|
txb.object(CLOCK_ADDRESS)
|
|
5286
5285
|
];
|
|
@@ -6753,6 +6752,35 @@ var SteammOmmV2 = class {
|
|
|
6753
6752
|
}
|
|
6754
6753
|
};
|
|
6755
6754
|
|
|
6755
|
+
// src/transaction/magma.ts
|
|
6756
|
+
var Magma = class {
|
|
6757
|
+
constructor(env) {
|
|
6758
|
+
if (env !== 0 /* Mainnet */) {
|
|
6759
|
+
throw new Error("Magma CLMM only supported on mainnet");
|
|
6760
|
+
}
|
|
6761
|
+
this.globalConfig = "0x4c4e1402401f72c7d8533d0ed8d5f8949da363c7a3319ccef261ffe153d32f8a";
|
|
6762
|
+
}
|
|
6763
|
+
swap(client, txb, path, inputCoin, packages) {
|
|
6764
|
+
return __async(this, null, function* () {
|
|
6765
|
+
const { direction, from, target } = path;
|
|
6766
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
6767
|
+
const args = [
|
|
6768
|
+
txb.object(this.globalConfig),
|
|
6769
|
+
txb.object(path.id),
|
|
6770
|
+
inputCoin,
|
|
6771
|
+
txb.object(CLOCK_ADDRESS)
|
|
6772
|
+
];
|
|
6773
|
+
const publishedAt = getAggregatorV2Extend2PublishedAt(client.publishedAtV2Extend2(), packages);
|
|
6774
|
+
const res = txb.moveCall({
|
|
6775
|
+
target: `${publishedAt}::magma::${func}`,
|
|
6776
|
+
typeArguments: [coinAType, coinBType],
|
|
6777
|
+
arguments: args
|
|
6778
|
+
});
|
|
6779
|
+
return res;
|
|
6780
|
+
});
|
|
6781
|
+
}
|
|
6782
|
+
};
|
|
6783
|
+
|
|
6756
6784
|
// src/client.ts
|
|
6757
6785
|
var CETUS = "CETUS";
|
|
6758
6786
|
var DEEPBOOKV2 = "DEEPBOOK";
|
|
@@ -6780,6 +6808,7 @@ var HAWAL = "HAWAL";
|
|
|
6780
6808
|
var STEAMM_OMM = "STEAMM_OMM";
|
|
6781
6809
|
var MOMENTUM = "MOMENTUM";
|
|
6782
6810
|
var STEAMM_OMM_V2 = "STEAMM_OMM_V2";
|
|
6811
|
+
var MAGMA = "MAGMA";
|
|
6783
6812
|
var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
6784
6813
|
var ALL_DEXES = [
|
|
6785
6814
|
CETUS,
|
|
@@ -6806,7 +6835,8 @@ var ALL_DEXES = [
|
|
|
6806
6835
|
HAWAL,
|
|
6807
6836
|
MOMENTUM,
|
|
6808
6837
|
STEAMM_OMM,
|
|
6809
|
-
STEAMM_OMM_V2
|
|
6838
|
+
STEAMM_OMM_V2,
|
|
6839
|
+
MAGMA
|
|
6810
6840
|
];
|
|
6811
6841
|
function isBuilderRouterSwapParams(params) {
|
|
6812
6842
|
return Array.isArray(params.routers);
|
|
@@ -7037,9 +7067,11 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7037
7067
|
);
|
|
7038
7068
|
for (let i = 0; i < routers.length; i++) {
|
|
7039
7069
|
const router = routers[i];
|
|
7070
|
+
let amount_arg = txb.pure.u64(router.amountOut.toString());
|
|
7040
7071
|
for (let j = router.path.length - 1; j >= 0; j--) {
|
|
7041
7072
|
const path = router.path[j];
|
|
7042
|
-
const flashSwapResult = dex.flash_swap(this, txb, path, false);
|
|
7073
|
+
const flashSwapResult = dex.flash_swap(this, txb, path, amount_arg, false);
|
|
7074
|
+
amount_arg = flashSwapResult.payAmount;
|
|
7043
7075
|
returnCoins.unshift(flashSwapResult.targetCoin);
|
|
7044
7076
|
receipts.unshift(flashSwapResult.flashReceipt);
|
|
7045
7077
|
}
|
|
@@ -7277,6 +7309,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7277
7309
|
byAmountIn,
|
|
7278
7310
|
slippage
|
|
7279
7311
|
);
|
|
7312
|
+
console.log("amountLimit", amountLimit.toString());
|
|
7280
7313
|
const amount = byAmountIn ? expectedAmountIn : amountLimit;
|
|
7281
7314
|
const buildFromCoinRes = buildInputCoin(
|
|
7282
7315
|
txb,
|
|
@@ -7357,7 +7390,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7357
7390
|
}
|
|
7358
7391
|
publishedAtV2Extend2() {
|
|
7359
7392
|
if (this.env === 0 /* Mainnet */) {
|
|
7360
|
-
return "
|
|
7393
|
+
return "0xc40b43f0aa4ba5a4d71e39770265d3698d0e6dcfd846b7d7c443207f4e919e04";
|
|
7361
7394
|
} else {
|
|
7362
7395
|
return "0x0";
|
|
7363
7396
|
}
|
|
@@ -7466,6 +7499,8 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7466
7499
|
return new Momentum(this.env);
|
|
7467
7500
|
case STEAMM_OMM_V2:
|
|
7468
7501
|
return new SteammOmmV2(this.env, pythPriceIDs);
|
|
7502
|
+
case MAGMA:
|
|
7503
|
+
return new Magma(this.env);
|
|
7469
7504
|
default:
|
|
7470
7505
|
throw new Error(`Unsupported dex ${provider}`);
|
|
7471
7506
|
}
|
|
@@ -7561,7 +7596,7 @@ _AggregatorClient.CONFIG = {
|
|
|
7561
7596
|
pythStateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"
|
|
7562
7597
|
}
|
|
7563
7598
|
};
|
|
7564
|
-
var
|
|
7599
|
+
var AggregatorClient27 = _AggregatorClient;
|
|
7565
7600
|
function findPythPriceIDs(routes) {
|
|
7566
7601
|
const priceIDs = /* @__PURE__ */ new Set();
|
|
7567
7602
|
for (const route of routes) {
|
|
@@ -7758,7 +7793,7 @@ function processEndpoint(endpoint) {
|
|
|
7758
7793
|
|
|
7759
7794
|
// src/api.ts
|
|
7760
7795
|
var import_bn7 = __toESM(require_bn());
|
|
7761
|
-
var SDK_VERSION =
|
|
7796
|
+
var SDK_VERSION = 1001300;
|
|
7762
7797
|
function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
|
|
7763
7798
|
return __async(this, null, function* () {
|
|
7764
7799
|
let response;
|
|
@@ -7962,4 +7997,4 @@ decimal.js/decimal.mjs:
|
|
|
7962
7997
|
*)
|
|
7963
7998
|
*/
|
|
7964
7999
|
|
|
7965
|
-
export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALL_DEXES, ALPHAFI,
|
|
8000
|
+
export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALL_DEXES, ALPHAFI, AggregatorClient27 as AggregatorClient, BLUEFIN, BLUEMOVE, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, Env, FLOWXV2, FLOWXV3, HAEDAL, HAEDALPMM, HAWAL, KRIYA, KRIYAV3, MAGMA, 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, getAllProviders, getDeepbookV3Config, getProvidersExcluding, getProvidersIncluding, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
|