@cetusprotocol/aggregator-sdk 0.12.1 → 0.13.1
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 +55 -8
- package/dist/index.mjs +50 -8
- package/package.json +4 -2
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
|
@@ -4,6 +4,11 @@ var client = require('@mysten/sui/client');
|
|
|
4
4
|
var utils = require('@mysten/sui/utils');
|
|
5
5
|
var transactions = require('@mysten/sui/transactions');
|
|
6
6
|
var pythSuiJs = require('@pythnetwork/pyth-sui-js');
|
|
7
|
+
var JSONbig = require('json-bigint');
|
|
8
|
+
|
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
|
|
11
|
+
var JSONbig__default = /*#__PURE__*/_interopDefault(JSONbig);
|
|
7
12
|
|
|
8
13
|
var __create = Object.create;
|
|
9
14
|
var __defProp = Object.defineProperty;
|
|
@@ -6754,6 +6759,35 @@ var SteammOmmV2 = class {
|
|
|
6754
6759
|
}
|
|
6755
6760
|
};
|
|
6756
6761
|
|
|
6762
|
+
// src/transaction/magma.ts
|
|
6763
|
+
var Magma = class {
|
|
6764
|
+
constructor(env) {
|
|
6765
|
+
if (env !== 0 /* Mainnet */) {
|
|
6766
|
+
throw new Error("Magma CLMM only supported on mainnet");
|
|
6767
|
+
}
|
|
6768
|
+
this.globalConfig = "0x4c4e1402401f72c7d8533d0ed8d5f8949da363c7a3319ccef261ffe153d32f8a";
|
|
6769
|
+
}
|
|
6770
|
+
swap(client, txb, path, inputCoin, packages) {
|
|
6771
|
+
return __async(this, null, function* () {
|
|
6772
|
+
const { direction, from, target } = path;
|
|
6773
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
6774
|
+
const args = [
|
|
6775
|
+
txb.object(this.globalConfig),
|
|
6776
|
+
txb.object(path.id),
|
|
6777
|
+
inputCoin,
|
|
6778
|
+
txb.object(CLOCK_ADDRESS)
|
|
6779
|
+
];
|
|
6780
|
+
const publishedAt = getAggregatorV2Extend2PublishedAt(client.publishedAtV2Extend2(), packages);
|
|
6781
|
+
const res = txb.moveCall({
|
|
6782
|
+
target: `${publishedAt}::magma::${func}`,
|
|
6783
|
+
typeArguments: [coinAType, coinBType],
|
|
6784
|
+
arguments: args
|
|
6785
|
+
});
|
|
6786
|
+
return res;
|
|
6787
|
+
});
|
|
6788
|
+
}
|
|
6789
|
+
};
|
|
6790
|
+
|
|
6757
6791
|
// src/client.ts
|
|
6758
6792
|
var CETUS = "CETUS";
|
|
6759
6793
|
var DEEPBOOKV2 = "DEEPBOOK";
|
|
@@ -6781,6 +6815,7 @@ var HAWAL = "HAWAL";
|
|
|
6781
6815
|
var STEAMM_OMM = "STEAMM_OMM";
|
|
6782
6816
|
var MOMENTUM = "MOMENTUM";
|
|
6783
6817
|
var STEAMM_OMM_V2 = "STEAMM_OMM_V2";
|
|
6818
|
+
var MAGMA = "MAGMA";
|
|
6784
6819
|
var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
6785
6820
|
var ALL_DEXES = [
|
|
6786
6821
|
CETUS,
|
|
@@ -6807,7 +6842,8 @@ var ALL_DEXES = [
|
|
|
6807
6842
|
HAWAL,
|
|
6808
6843
|
MOMENTUM,
|
|
6809
6844
|
STEAMM_OMM,
|
|
6810
|
-
STEAMM_OMM_V2
|
|
6845
|
+
STEAMM_OMM_V2,
|
|
6846
|
+
MAGMA
|
|
6811
6847
|
];
|
|
6812
6848
|
function isBuilderRouterSwapParams(params) {
|
|
6813
6849
|
return Array.isArray(params.routers);
|
|
@@ -7038,10 +7074,18 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7038
7074
|
);
|
|
7039
7075
|
for (let i = 0; i < routers.length; i++) {
|
|
7040
7076
|
const router = routers[i];
|
|
7041
|
-
let amount_arg = txb.pure.u64(
|
|
7077
|
+
let amount_arg = txb.pure.u64(
|
|
7078
|
+
router.amountOut.toString()
|
|
7079
|
+
);
|
|
7042
7080
|
for (let j = router.path.length - 1; j >= 0; j--) {
|
|
7043
7081
|
const path = router.path[j];
|
|
7044
|
-
const flashSwapResult = dex.flash_swap(
|
|
7082
|
+
const flashSwapResult = dex.flash_swap(
|
|
7083
|
+
this,
|
|
7084
|
+
txb,
|
|
7085
|
+
path,
|
|
7086
|
+
amount_arg,
|
|
7087
|
+
false
|
|
7088
|
+
);
|
|
7045
7089
|
amount_arg = flashSwapResult.payAmount;
|
|
7046
7090
|
returnCoins.unshift(flashSwapResult.targetCoin);
|
|
7047
7091
|
receipts.unshift(flashSwapResult.flashReceipt);
|
|
@@ -7361,7 +7405,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7361
7405
|
}
|
|
7362
7406
|
publishedAtV2Extend2() {
|
|
7363
7407
|
if (this.env === 0 /* Mainnet */) {
|
|
7364
|
-
return "
|
|
7408
|
+
return "0xc40b43f0aa4ba5a4d71e39770265d3698d0e6dcfd846b7d7c443207f4e919e04";
|
|
7365
7409
|
} else {
|
|
7366
7410
|
return "0x0";
|
|
7367
7411
|
}
|
|
@@ -7470,6 +7514,8 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7470
7514
|
return new Momentum(this.env);
|
|
7471
7515
|
case STEAMM_OMM_V2:
|
|
7472
7516
|
return new SteammOmmV2(this.env, pythPriceIDs);
|
|
7517
|
+
case MAGMA:
|
|
7518
|
+
return new Magma(this.env);
|
|
7473
7519
|
default:
|
|
7474
7520
|
throw new Error(`Unsupported dex ${provider}`);
|
|
7475
7521
|
}
|
|
@@ -7565,7 +7611,7 @@ _AggregatorClient.CONFIG = {
|
|
|
7565
7611
|
pythStateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"
|
|
7566
7612
|
}
|
|
7567
7613
|
};
|
|
7568
|
-
var
|
|
7614
|
+
var AggregatorClient27 = _AggregatorClient;
|
|
7569
7615
|
function findPythPriceIDs(routes) {
|
|
7570
7616
|
const priceIDs = /* @__PURE__ */ new Set();
|
|
7571
7617
|
for (const route of routes) {
|
|
@@ -7762,7 +7808,7 @@ function processEndpoint(endpoint) {
|
|
|
7762
7808
|
|
|
7763
7809
|
// src/api.ts
|
|
7764
7810
|
var import_bn7 = __toESM(require_bn());
|
|
7765
|
-
var SDK_VERSION =
|
|
7811
|
+
var SDK_VERSION = 1001300;
|
|
7766
7812
|
function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
|
|
7767
7813
|
return __async(this, null, function* () {
|
|
7768
7814
|
let response;
|
|
@@ -7791,7 +7837,7 @@ function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceive
|
|
|
7791
7837
|
}
|
|
7792
7838
|
};
|
|
7793
7839
|
}
|
|
7794
|
-
const data = yield response.
|
|
7840
|
+
const data = JSONbig__default.default.parse(yield response.text());
|
|
7795
7841
|
const insufficientLiquidity = data.msg === "liquidity is not enough";
|
|
7796
7842
|
if (data.msg && data.msg.indexOf("HoneyPot scam") > -1) {
|
|
7797
7843
|
return {
|
|
@@ -7973,7 +8019,7 @@ exports.AGGREGATOR_V2_EXTEND = AGGREGATOR_V2_EXTEND;
|
|
|
7973
8019
|
exports.AGGREGATOR_V2_EXTEND2 = AGGREGATOR_V2_EXTEND2;
|
|
7974
8020
|
exports.ALL_DEXES = ALL_DEXES;
|
|
7975
8021
|
exports.ALPHAFI = ALPHAFI;
|
|
7976
|
-
exports.AggregatorClient =
|
|
8022
|
+
exports.AggregatorClient = AggregatorClient27;
|
|
7977
8023
|
exports.BLUEFIN = BLUEFIN;
|
|
7978
8024
|
exports.BLUEMOVE = BLUEMOVE;
|
|
7979
8025
|
exports.CETUS = CETUS;
|
|
@@ -7989,6 +8035,7 @@ exports.HAEDALPMM = HAEDALPMM;
|
|
|
7989
8035
|
exports.HAWAL = HAWAL;
|
|
7990
8036
|
exports.KRIYA = KRIYA;
|
|
7991
8037
|
exports.KRIYAV3 = KRIYAV3;
|
|
8038
|
+
exports.MAGMA = MAGMA;
|
|
7992
8039
|
exports.METASTABLE = METASTABLE;
|
|
7993
8040
|
exports.MOMENTUM = MOMENTUM;
|
|
7994
8041
|
exports.OBRIC = OBRIC;
|
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { SuiClient, getFullnodeUrl } from '@mysten/sui/client';
|
|
|
2
2
|
import { normalizeSuiObjectId, SUI_CLOCK_OBJECT_ID, SUI_FRAMEWORK_ADDRESS } from '@mysten/sui/utils';
|
|
3
3
|
import { Transaction } from '@mysten/sui/transactions';
|
|
4
4
|
import { SuiPythClient, SuiPriceServiceConnection } from '@pythnetwork/pyth-sui-js';
|
|
5
|
+
import JSONbig from 'json-bigint';
|
|
5
6
|
|
|
6
7
|
var __create = Object.create;
|
|
7
8
|
var __defProp = Object.defineProperty;
|
|
@@ -6752,6 +6753,35 @@ var SteammOmmV2 = class {
|
|
|
6752
6753
|
}
|
|
6753
6754
|
};
|
|
6754
6755
|
|
|
6756
|
+
// src/transaction/magma.ts
|
|
6757
|
+
var Magma = class {
|
|
6758
|
+
constructor(env) {
|
|
6759
|
+
if (env !== 0 /* Mainnet */) {
|
|
6760
|
+
throw new Error("Magma CLMM only supported on mainnet");
|
|
6761
|
+
}
|
|
6762
|
+
this.globalConfig = "0x4c4e1402401f72c7d8533d0ed8d5f8949da363c7a3319ccef261ffe153d32f8a";
|
|
6763
|
+
}
|
|
6764
|
+
swap(client, txb, path, inputCoin, packages) {
|
|
6765
|
+
return __async(this, null, function* () {
|
|
6766
|
+
const { direction, from, target } = path;
|
|
6767
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
6768
|
+
const args = [
|
|
6769
|
+
txb.object(this.globalConfig),
|
|
6770
|
+
txb.object(path.id),
|
|
6771
|
+
inputCoin,
|
|
6772
|
+
txb.object(CLOCK_ADDRESS)
|
|
6773
|
+
];
|
|
6774
|
+
const publishedAt = getAggregatorV2Extend2PublishedAt(client.publishedAtV2Extend2(), packages);
|
|
6775
|
+
const res = txb.moveCall({
|
|
6776
|
+
target: `${publishedAt}::magma::${func}`,
|
|
6777
|
+
typeArguments: [coinAType, coinBType],
|
|
6778
|
+
arguments: args
|
|
6779
|
+
});
|
|
6780
|
+
return res;
|
|
6781
|
+
});
|
|
6782
|
+
}
|
|
6783
|
+
};
|
|
6784
|
+
|
|
6755
6785
|
// src/client.ts
|
|
6756
6786
|
var CETUS = "CETUS";
|
|
6757
6787
|
var DEEPBOOKV2 = "DEEPBOOK";
|
|
@@ -6779,6 +6809,7 @@ var HAWAL = "HAWAL";
|
|
|
6779
6809
|
var STEAMM_OMM = "STEAMM_OMM";
|
|
6780
6810
|
var MOMENTUM = "MOMENTUM";
|
|
6781
6811
|
var STEAMM_OMM_V2 = "STEAMM_OMM_V2";
|
|
6812
|
+
var MAGMA = "MAGMA";
|
|
6782
6813
|
var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
6783
6814
|
var ALL_DEXES = [
|
|
6784
6815
|
CETUS,
|
|
@@ -6805,7 +6836,8 @@ var ALL_DEXES = [
|
|
|
6805
6836
|
HAWAL,
|
|
6806
6837
|
MOMENTUM,
|
|
6807
6838
|
STEAMM_OMM,
|
|
6808
|
-
STEAMM_OMM_V2
|
|
6839
|
+
STEAMM_OMM_V2,
|
|
6840
|
+
MAGMA
|
|
6809
6841
|
];
|
|
6810
6842
|
function isBuilderRouterSwapParams(params) {
|
|
6811
6843
|
return Array.isArray(params.routers);
|
|
@@ -7036,10 +7068,18 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7036
7068
|
);
|
|
7037
7069
|
for (let i = 0; i < routers.length; i++) {
|
|
7038
7070
|
const router = routers[i];
|
|
7039
|
-
let amount_arg = txb.pure.u64(
|
|
7071
|
+
let amount_arg = txb.pure.u64(
|
|
7072
|
+
router.amountOut.toString()
|
|
7073
|
+
);
|
|
7040
7074
|
for (let j = router.path.length - 1; j >= 0; j--) {
|
|
7041
7075
|
const path = router.path[j];
|
|
7042
|
-
const flashSwapResult = dex.flash_swap(
|
|
7076
|
+
const flashSwapResult = dex.flash_swap(
|
|
7077
|
+
this,
|
|
7078
|
+
txb,
|
|
7079
|
+
path,
|
|
7080
|
+
amount_arg,
|
|
7081
|
+
false
|
|
7082
|
+
);
|
|
7043
7083
|
amount_arg = flashSwapResult.payAmount;
|
|
7044
7084
|
returnCoins.unshift(flashSwapResult.targetCoin);
|
|
7045
7085
|
receipts.unshift(flashSwapResult.flashReceipt);
|
|
@@ -7359,7 +7399,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7359
7399
|
}
|
|
7360
7400
|
publishedAtV2Extend2() {
|
|
7361
7401
|
if (this.env === 0 /* Mainnet */) {
|
|
7362
|
-
return "
|
|
7402
|
+
return "0xc40b43f0aa4ba5a4d71e39770265d3698d0e6dcfd846b7d7c443207f4e919e04";
|
|
7363
7403
|
} else {
|
|
7364
7404
|
return "0x0";
|
|
7365
7405
|
}
|
|
@@ -7468,6 +7508,8 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7468
7508
|
return new Momentum(this.env);
|
|
7469
7509
|
case STEAMM_OMM_V2:
|
|
7470
7510
|
return new SteammOmmV2(this.env, pythPriceIDs);
|
|
7511
|
+
case MAGMA:
|
|
7512
|
+
return new Magma(this.env);
|
|
7471
7513
|
default:
|
|
7472
7514
|
throw new Error(`Unsupported dex ${provider}`);
|
|
7473
7515
|
}
|
|
@@ -7563,7 +7605,7 @@ _AggregatorClient.CONFIG = {
|
|
|
7563
7605
|
pythStateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"
|
|
7564
7606
|
}
|
|
7565
7607
|
};
|
|
7566
|
-
var
|
|
7608
|
+
var AggregatorClient27 = _AggregatorClient;
|
|
7567
7609
|
function findPythPriceIDs(routes) {
|
|
7568
7610
|
const priceIDs = /* @__PURE__ */ new Set();
|
|
7569
7611
|
for (const route of routes) {
|
|
@@ -7760,7 +7802,7 @@ function processEndpoint(endpoint) {
|
|
|
7760
7802
|
|
|
7761
7803
|
// src/api.ts
|
|
7762
7804
|
var import_bn7 = __toESM(require_bn());
|
|
7763
|
-
var SDK_VERSION =
|
|
7805
|
+
var SDK_VERSION = 1001300;
|
|
7764
7806
|
function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
|
|
7765
7807
|
return __async(this, null, function* () {
|
|
7766
7808
|
let response;
|
|
@@ -7789,7 +7831,7 @@ function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceive
|
|
|
7789
7831
|
}
|
|
7790
7832
|
};
|
|
7791
7833
|
}
|
|
7792
|
-
const data = yield response.
|
|
7834
|
+
const data = JSONbig.parse(yield response.text());
|
|
7793
7835
|
const insufficientLiquidity = data.msg === "liquidity is not enough";
|
|
7794
7836
|
if (data.msg && data.msg.indexOf("HoneyPot scam") > -1) {
|
|
7795
7837
|
return {
|
|
@@ -7964,4 +8006,4 @@ decimal.js/decimal.mjs:
|
|
|
7964
8006
|
*)
|
|
7965
8007
|
*/
|
|
7966
8008
|
|
|
7967
|
-
export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALL_DEXES, ALPHAFI,
|
|
8009
|
+
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cetusprotocol/aggregator-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -30,13 +30,15 @@
|
|
|
30
30
|
"@mysten/sui": "^1.6.0",
|
|
31
31
|
"@pythnetwork/pyth-sui-js": "^2.1.0",
|
|
32
32
|
"@types/jest": "^29.5.12",
|
|
33
|
+
"@types/json-bigint": "^1.0.4",
|
|
33
34
|
"@types/node": "^20.12.12",
|
|
34
35
|
"babel-jest": "^29.7.0",
|
|
35
36
|
"bip39": "^3.1.0",
|
|
36
37
|
"dotenv": "^16.4.5",
|
|
37
38
|
"jest": "^29.7.0",
|
|
39
|
+
"json-bigint": "^1.0.0",
|
|
38
40
|
"node-fetch": "^3.3.2",
|
|
39
41
|
"ts-jest": "^29.1.3",
|
|
40
|
-
"typescript": "^5.
|
|
42
|
+
"typescript": "^5.0.0"
|
|
41
43
|
}
|
|
42
44
|
}
|