@cetusprotocol/aggregator-sdk 0.7.0 → 0.9.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 +46 -18
- package/dist/index.mjs +45 -18
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -85,6 +85,7 @@ declare const METASTABLE = "METASTABLE";
|
|
|
85
85
|
declare const OBRIC = "OBRIC";
|
|
86
86
|
declare const HAWAL = "HAWAL";
|
|
87
87
|
declare const STEAMM_OMM = "STEAMM_OMM";
|
|
88
|
+
declare const MOMENTUM = "MOMENTUM";
|
|
88
89
|
declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
89
90
|
type BuildRouterSwapParams = {
|
|
90
91
|
routers: Router[];
|
|
@@ -349,4 +350,4 @@ declare enum Env {
|
|
|
349
350
|
Testnet = 1
|
|
350
351
|
}
|
|
351
352
|
|
|
352
|
-
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, 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -85,6 +85,7 @@ declare const METASTABLE = "METASTABLE";
|
|
|
85
85
|
declare const OBRIC = "OBRIC";
|
|
86
86
|
declare const HAWAL = "HAWAL";
|
|
87
87
|
declare const STEAMM_OMM = "STEAMM_OMM";
|
|
88
|
+
declare const MOMENTUM = "MOMENTUM";
|
|
88
89
|
declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
89
90
|
type BuildRouterSwapParams = {
|
|
90
91
|
routers: Router[];
|
|
@@ -349,4 +350,4 @@ declare enum Env {
|
|
|
349
350
|
Testnet = 1
|
|
350
351
|
}
|
|
351
352
|
|
|
352
|
-
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, 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -5991,23 +5991,20 @@ var Volo = class {
|
|
|
5991
5991
|
if (env !== 0 /* Mainnet */) {
|
|
5992
5992
|
throw new Error("Volo only supported on mainnet");
|
|
5993
5993
|
}
|
|
5994
|
-
this.
|
|
5994
|
+
this.stakePool = "0x2d914e23d82fedef1b5f56a32d5c64bdcc3087ccfea2b4d6ea51a71f587840e5";
|
|
5995
5995
|
this.metadata = "0x680cd26af32b2bde8d3361e804c53ec1d1cfe24c7f039eb7f549e8dfde389a60";
|
|
5996
5996
|
}
|
|
5997
5997
|
swap(client, txb, path, inputCoin, packages) {
|
|
5998
5998
|
return __async(this, null, function* () {
|
|
5999
5999
|
const { direction } = path;
|
|
6000
|
-
|
|
6001
|
-
throw new Error("Volo not support b2a swap");
|
|
6002
|
-
}
|
|
6003
|
-
const func = "swap_a2b";
|
|
6000
|
+
const func = direction ? "swap_a2b" : "swap_b2a";
|
|
6004
6001
|
const args = [
|
|
6005
|
-
txb.object(this.
|
|
6002
|
+
txb.object(this.stakePool),
|
|
6006
6003
|
txb.object(this.metadata),
|
|
6007
6004
|
txb.object("0x5"),
|
|
6008
6005
|
inputCoin
|
|
6009
6006
|
];
|
|
6010
|
-
const publishedAt =
|
|
6007
|
+
const publishedAt = getAggregatorV2Extend2PublishedAt(client.publishedAtV2Extend2(), packages);
|
|
6011
6008
|
const res = txb.moveCall({
|
|
6012
6009
|
target: `${publishedAt}::volo::${func}`,
|
|
6013
6010
|
typeArguments: [],
|
|
@@ -6259,7 +6256,7 @@ var SteammCPMM = class {
|
|
|
6259
6256
|
swap(client, txb, path, inputCoin, packages) {
|
|
6260
6257
|
return __async(this, null, function* () {
|
|
6261
6258
|
const { direction, from, target } = path;
|
|
6262
|
-
const [func, coinAType, coinBType] = direction ? ["
|
|
6259
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b_v2", from, target] : ["swap_b2a_v2", target, from];
|
|
6263
6260
|
if (path.extendedDetails == null) {
|
|
6264
6261
|
throw new Error("Extended details not supported");
|
|
6265
6262
|
} else {
|
|
@@ -6293,9 +6290,9 @@ var SteammCPMM = class {
|
|
|
6293
6290
|
inputCoin,
|
|
6294
6291
|
txb.object(CLOCK_ADDRESS)
|
|
6295
6292
|
];
|
|
6296
|
-
const publishedAt =
|
|
6293
|
+
const publishedAt = getAggregatorV2Extend2PublishedAt(client.publishedAtV2Extend2(), packages);
|
|
6297
6294
|
const res = txb.moveCall({
|
|
6298
|
-
target: `${publishedAt}::
|
|
6295
|
+
target: `${publishedAt}::steamm_cpmm::${func}`,
|
|
6299
6296
|
typeArguments: [
|
|
6300
6297
|
path.extendedDetails.steammLendingMarketType,
|
|
6301
6298
|
coinAType,
|
|
@@ -6363,7 +6360,7 @@ var SteammOmm = class {
|
|
|
6363
6360
|
throw new Error("Steamm oracle pyth price seed b not supported");
|
|
6364
6361
|
}
|
|
6365
6362
|
}
|
|
6366
|
-
const [func, coinAType, coinBType] = direction ? ["
|
|
6363
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b_v2", from, target] : ["swap_b2a_v2", target, from];
|
|
6367
6364
|
const priceSeedA = path.extendedDetails.steammOraclePythPriceSeedA;
|
|
6368
6365
|
const priceSeedB = path.extendedDetails.steammOraclePythPriceSeedB;
|
|
6369
6366
|
const priceInfoObjectIdA = this.pythPriceIDs.get(priceSeedA);
|
|
@@ -6621,6 +6618,35 @@ var HaWAL = class {
|
|
|
6621
6618
|
}
|
|
6622
6619
|
};
|
|
6623
6620
|
|
|
6621
|
+
// src/transaction/momentum.ts
|
|
6622
|
+
var Momentum = class {
|
|
6623
|
+
constructor(env) {
|
|
6624
|
+
if (env !== 0 /* Mainnet */) {
|
|
6625
|
+
throw new Error("Momentum only supported on mainnet");
|
|
6626
|
+
}
|
|
6627
|
+
this.version = "0x2375a0b1ec12010aaea3b2545acfa2ad34cfbba03ce4b59f4c39e1e25eed1b2a";
|
|
6628
|
+
}
|
|
6629
|
+
swap(client, txb, path, inputCoin, packages) {
|
|
6630
|
+
return __async(this, null, function* () {
|
|
6631
|
+
const { direction, from, target } = path;
|
|
6632
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
6633
|
+
const args = [
|
|
6634
|
+
txb.object(path.id),
|
|
6635
|
+
inputCoin,
|
|
6636
|
+
txb.object(this.version),
|
|
6637
|
+
txb.object(CLOCK_ADDRESS)
|
|
6638
|
+
];
|
|
6639
|
+
const publishedAt = getAggregatorV2Extend2PublishedAt(client.publishedAtV2Extend2(), packages);
|
|
6640
|
+
const res = txb.moveCall({
|
|
6641
|
+
target: `${publishedAt}::momentum::${func}`,
|
|
6642
|
+
typeArguments: [coinAType, coinBType],
|
|
6643
|
+
arguments: args
|
|
6644
|
+
});
|
|
6645
|
+
return res;
|
|
6646
|
+
});
|
|
6647
|
+
}
|
|
6648
|
+
};
|
|
6649
|
+
|
|
6624
6650
|
// src/client.ts
|
|
6625
6651
|
var CETUS = "CETUS";
|
|
6626
6652
|
var DEEPBOOKV2 = "DEEPBOOK";
|
|
@@ -6646,6 +6672,7 @@ var METASTABLE = "METASTABLE";
|
|
|
6646
6672
|
var OBRIC = "OBRIC";
|
|
6647
6673
|
var HAWAL = "HAWAL";
|
|
6648
6674
|
var STEAMM_OMM = "STEAMM_OMM";
|
|
6675
|
+
var MOMENTUM = "MOMENTUM";
|
|
6649
6676
|
var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
6650
6677
|
function isBuilderRouterSwapParams(params) {
|
|
6651
6678
|
return Array.isArray(params.routers);
|
|
@@ -7162,14 +7189,14 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7162
7189
|
// Include deepbookv3, scallop, bluefin
|
|
7163
7190
|
publishedAtV2Extend() {
|
|
7164
7191
|
if (this.env === 0 /* Mainnet */) {
|
|
7165
|
-
return "
|
|
7192
|
+
return "0xa2fe8e900d719813fee1ffaea14d5a2b5516a4d15b75f14aa0cf27c531c20ae3";
|
|
7166
7193
|
} else {
|
|
7167
7194
|
return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
|
|
7168
7195
|
}
|
|
7169
7196
|
}
|
|
7170
7197
|
publishedAtV2Extend2() {
|
|
7171
7198
|
if (this.env === 0 /* Mainnet */) {
|
|
7172
|
-
return "
|
|
7199
|
+
return "0x1727de5223a86156c0fd4ee290aaabaea7f0ffeff485c367c2eb0dcbdfc0061a";
|
|
7173
7200
|
} else {
|
|
7174
7201
|
return "0x0";
|
|
7175
7202
|
}
|
|
@@ -7274,6 +7301,8 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7274
7301
|
return new Obric(this.env, pythPriceIDs);
|
|
7275
7302
|
case HAWAL:
|
|
7276
7303
|
return new HaWAL(this.env);
|
|
7304
|
+
case MOMENTUM:
|
|
7305
|
+
return new Momentum(this.env);
|
|
7277
7306
|
default:
|
|
7278
7307
|
throw new Error(`Unsupported dex ${provider}`);
|
|
7279
7308
|
}
|
|
@@ -7367,7 +7396,7 @@ _AggregatorClient.CONFIG = {
|
|
|
7367
7396
|
pythStateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"
|
|
7368
7397
|
}
|
|
7369
7398
|
};
|
|
7370
|
-
var
|
|
7399
|
+
var AggregatorClient25 = _AggregatorClient;
|
|
7371
7400
|
function findPythPriceIDs(routes) {
|
|
7372
7401
|
const priceIDs = /* @__PURE__ */ new Set();
|
|
7373
7402
|
for (const route of routes) {
|
|
@@ -7435,7 +7464,6 @@ function parseRouterResponse(data, byAmountIn) {
|
|
|
7435
7464
|
if (path.provider === AFTERMATH) {
|
|
7436
7465
|
version = path.extended_details.aftermath_pool_flatness === 0 ? "v2" : "v3";
|
|
7437
7466
|
}
|
|
7438
|
-
console.log("path: ", path.extended_details);
|
|
7439
7467
|
let extendedDetails;
|
|
7440
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) {
|
|
7441
7469
|
extendedDetails = {
|
|
@@ -7565,7 +7593,7 @@ function processEndpoint(endpoint) {
|
|
|
7565
7593
|
|
|
7566
7594
|
// src/api.ts
|
|
7567
7595
|
var import_bn7 = __toESM(require_bn());
|
|
7568
|
-
var SDK_VERSION =
|
|
7596
|
+
var SDK_VERSION = 1000900;
|
|
7569
7597
|
function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
|
|
7570
7598
|
return __async(this, null, function* () {
|
|
7571
7599
|
let response;
|
|
@@ -7612,7 +7640,6 @@ function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceive
|
|
|
7612
7640
|
};
|
|
7613
7641
|
}
|
|
7614
7642
|
if (data.data != null) {
|
|
7615
|
-
console.log("data: ", JSON.stringify(data.data, null, 2));
|
|
7616
7643
|
const res = parseRouterResponse(data.data, params.byAmountIn);
|
|
7617
7644
|
if (overlayFee > 0 && overlayFeeReceiver !== "0x0") {
|
|
7618
7645
|
if (params.byAmountIn) {
|
|
@@ -7776,7 +7803,7 @@ exports.AGGREGATOR_V2 = AGGREGATOR_V2;
|
|
|
7776
7803
|
exports.AGGREGATOR_V2_EXTEND = AGGREGATOR_V2_EXTEND;
|
|
7777
7804
|
exports.AGGREGATOR_V2_EXTEND2 = AGGREGATOR_V2_EXTEND2;
|
|
7778
7805
|
exports.ALPHAFI = ALPHAFI;
|
|
7779
|
-
exports.AggregatorClient =
|
|
7806
|
+
exports.AggregatorClient = AggregatorClient25;
|
|
7780
7807
|
exports.BLUEFIN = BLUEFIN;
|
|
7781
7808
|
exports.BLUEMOVE = BLUEMOVE;
|
|
7782
7809
|
exports.CETUS = CETUS;
|
|
@@ -7793,6 +7820,7 @@ exports.HAWAL = HAWAL;
|
|
|
7793
7820
|
exports.KRIYA = KRIYA;
|
|
7794
7821
|
exports.KRIYAV3 = KRIYAV3;
|
|
7795
7822
|
exports.METASTABLE = METASTABLE;
|
|
7823
|
+
exports.MOMENTUM = MOMENTUM;
|
|
7796
7824
|
exports.OBRIC = OBRIC;
|
|
7797
7825
|
exports.ONE = ONE;
|
|
7798
7826
|
exports.SCALLOP = SCALLOP;
|
package/dist/index.mjs
CHANGED
|
@@ -5989,23 +5989,20 @@ var Volo = class {
|
|
|
5989
5989
|
if (env !== 0 /* Mainnet */) {
|
|
5990
5990
|
throw new Error("Volo only supported on mainnet");
|
|
5991
5991
|
}
|
|
5992
|
-
this.
|
|
5992
|
+
this.stakePool = "0x2d914e23d82fedef1b5f56a32d5c64bdcc3087ccfea2b4d6ea51a71f587840e5";
|
|
5993
5993
|
this.metadata = "0x680cd26af32b2bde8d3361e804c53ec1d1cfe24c7f039eb7f549e8dfde389a60";
|
|
5994
5994
|
}
|
|
5995
5995
|
swap(client, txb, path, inputCoin, packages) {
|
|
5996
5996
|
return __async(this, null, function* () {
|
|
5997
5997
|
const { direction } = path;
|
|
5998
|
-
|
|
5999
|
-
throw new Error("Volo not support b2a swap");
|
|
6000
|
-
}
|
|
6001
|
-
const func = "swap_a2b";
|
|
5998
|
+
const func = direction ? "swap_a2b" : "swap_b2a";
|
|
6002
5999
|
const args = [
|
|
6003
|
-
txb.object(this.
|
|
6000
|
+
txb.object(this.stakePool),
|
|
6004
6001
|
txb.object(this.metadata),
|
|
6005
6002
|
txb.object("0x5"),
|
|
6006
6003
|
inputCoin
|
|
6007
6004
|
];
|
|
6008
|
-
const publishedAt =
|
|
6005
|
+
const publishedAt = getAggregatorV2Extend2PublishedAt(client.publishedAtV2Extend2(), packages);
|
|
6009
6006
|
const res = txb.moveCall({
|
|
6010
6007
|
target: `${publishedAt}::volo::${func}`,
|
|
6011
6008
|
typeArguments: [],
|
|
@@ -6257,7 +6254,7 @@ var SteammCPMM = class {
|
|
|
6257
6254
|
swap(client, txb, path, inputCoin, packages) {
|
|
6258
6255
|
return __async(this, null, function* () {
|
|
6259
6256
|
const { direction, from, target } = path;
|
|
6260
|
-
const [func, coinAType, coinBType] = direction ? ["
|
|
6257
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b_v2", from, target] : ["swap_b2a_v2", target, from];
|
|
6261
6258
|
if (path.extendedDetails == null) {
|
|
6262
6259
|
throw new Error("Extended details not supported");
|
|
6263
6260
|
} else {
|
|
@@ -6291,9 +6288,9 @@ var SteammCPMM = class {
|
|
|
6291
6288
|
inputCoin,
|
|
6292
6289
|
txb.object(CLOCK_ADDRESS)
|
|
6293
6290
|
];
|
|
6294
|
-
const publishedAt =
|
|
6291
|
+
const publishedAt = getAggregatorV2Extend2PublishedAt(client.publishedAtV2Extend2(), packages);
|
|
6295
6292
|
const res = txb.moveCall({
|
|
6296
|
-
target: `${publishedAt}::
|
|
6293
|
+
target: `${publishedAt}::steamm_cpmm::${func}`,
|
|
6297
6294
|
typeArguments: [
|
|
6298
6295
|
path.extendedDetails.steammLendingMarketType,
|
|
6299
6296
|
coinAType,
|
|
@@ -6361,7 +6358,7 @@ var SteammOmm = class {
|
|
|
6361
6358
|
throw new Error("Steamm oracle pyth price seed b not supported");
|
|
6362
6359
|
}
|
|
6363
6360
|
}
|
|
6364
|
-
const [func, coinAType, coinBType] = direction ? ["
|
|
6361
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b_v2", from, target] : ["swap_b2a_v2", target, from];
|
|
6365
6362
|
const priceSeedA = path.extendedDetails.steammOraclePythPriceSeedA;
|
|
6366
6363
|
const priceSeedB = path.extendedDetails.steammOraclePythPriceSeedB;
|
|
6367
6364
|
const priceInfoObjectIdA = this.pythPriceIDs.get(priceSeedA);
|
|
@@ -6619,6 +6616,35 @@ var HaWAL = class {
|
|
|
6619
6616
|
}
|
|
6620
6617
|
};
|
|
6621
6618
|
|
|
6619
|
+
// src/transaction/momentum.ts
|
|
6620
|
+
var Momentum = class {
|
|
6621
|
+
constructor(env) {
|
|
6622
|
+
if (env !== 0 /* Mainnet */) {
|
|
6623
|
+
throw new Error("Momentum only supported on mainnet");
|
|
6624
|
+
}
|
|
6625
|
+
this.version = "0x2375a0b1ec12010aaea3b2545acfa2ad34cfbba03ce4b59f4c39e1e25eed1b2a";
|
|
6626
|
+
}
|
|
6627
|
+
swap(client, txb, path, inputCoin, packages) {
|
|
6628
|
+
return __async(this, null, function* () {
|
|
6629
|
+
const { direction, from, target } = path;
|
|
6630
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
6631
|
+
const args = [
|
|
6632
|
+
txb.object(path.id),
|
|
6633
|
+
inputCoin,
|
|
6634
|
+
txb.object(this.version),
|
|
6635
|
+
txb.object(CLOCK_ADDRESS)
|
|
6636
|
+
];
|
|
6637
|
+
const publishedAt = getAggregatorV2Extend2PublishedAt(client.publishedAtV2Extend2(), packages);
|
|
6638
|
+
const res = txb.moveCall({
|
|
6639
|
+
target: `${publishedAt}::momentum::${func}`,
|
|
6640
|
+
typeArguments: [coinAType, coinBType],
|
|
6641
|
+
arguments: args
|
|
6642
|
+
});
|
|
6643
|
+
return res;
|
|
6644
|
+
});
|
|
6645
|
+
}
|
|
6646
|
+
};
|
|
6647
|
+
|
|
6622
6648
|
// src/client.ts
|
|
6623
6649
|
var CETUS = "CETUS";
|
|
6624
6650
|
var DEEPBOOKV2 = "DEEPBOOK";
|
|
@@ -6644,6 +6670,7 @@ var METASTABLE = "METASTABLE";
|
|
|
6644
6670
|
var OBRIC = "OBRIC";
|
|
6645
6671
|
var HAWAL = "HAWAL";
|
|
6646
6672
|
var STEAMM_OMM = "STEAMM_OMM";
|
|
6673
|
+
var MOMENTUM = "MOMENTUM";
|
|
6647
6674
|
var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
6648
6675
|
function isBuilderRouterSwapParams(params) {
|
|
6649
6676
|
return Array.isArray(params.routers);
|
|
@@ -7160,14 +7187,14 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7160
7187
|
// Include deepbookv3, scallop, bluefin
|
|
7161
7188
|
publishedAtV2Extend() {
|
|
7162
7189
|
if (this.env === 0 /* Mainnet */) {
|
|
7163
|
-
return "
|
|
7190
|
+
return "0xa2fe8e900d719813fee1ffaea14d5a2b5516a4d15b75f14aa0cf27c531c20ae3";
|
|
7164
7191
|
} else {
|
|
7165
7192
|
return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
|
|
7166
7193
|
}
|
|
7167
7194
|
}
|
|
7168
7195
|
publishedAtV2Extend2() {
|
|
7169
7196
|
if (this.env === 0 /* Mainnet */) {
|
|
7170
|
-
return "
|
|
7197
|
+
return "0x1727de5223a86156c0fd4ee290aaabaea7f0ffeff485c367c2eb0dcbdfc0061a";
|
|
7171
7198
|
} else {
|
|
7172
7199
|
return "0x0";
|
|
7173
7200
|
}
|
|
@@ -7272,6 +7299,8 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7272
7299
|
return new Obric(this.env, pythPriceIDs);
|
|
7273
7300
|
case HAWAL:
|
|
7274
7301
|
return new HaWAL(this.env);
|
|
7302
|
+
case MOMENTUM:
|
|
7303
|
+
return new Momentum(this.env);
|
|
7275
7304
|
default:
|
|
7276
7305
|
throw new Error(`Unsupported dex ${provider}`);
|
|
7277
7306
|
}
|
|
@@ -7365,7 +7394,7 @@ _AggregatorClient.CONFIG = {
|
|
|
7365
7394
|
pythStateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"
|
|
7366
7395
|
}
|
|
7367
7396
|
};
|
|
7368
|
-
var
|
|
7397
|
+
var AggregatorClient25 = _AggregatorClient;
|
|
7369
7398
|
function findPythPriceIDs(routes) {
|
|
7370
7399
|
const priceIDs = /* @__PURE__ */ new Set();
|
|
7371
7400
|
for (const route of routes) {
|
|
@@ -7433,7 +7462,6 @@ function parseRouterResponse(data, byAmountIn) {
|
|
|
7433
7462
|
if (path.provider === AFTERMATH) {
|
|
7434
7463
|
version = path.extended_details.aftermath_pool_flatness === 0 ? "v2" : "v3";
|
|
7435
7464
|
}
|
|
7436
|
-
console.log("path: ", path.extended_details);
|
|
7437
7465
|
let extendedDetails;
|
|
7438
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) {
|
|
7439
7467
|
extendedDetails = {
|
|
@@ -7563,7 +7591,7 @@ function processEndpoint(endpoint) {
|
|
|
7563
7591
|
|
|
7564
7592
|
// src/api.ts
|
|
7565
7593
|
var import_bn7 = __toESM(require_bn());
|
|
7566
|
-
var SDK_VERSION =
|
|
7594
|
+
var SDK_VERSION = 1000900;
|
|
7567
7595
|
function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
|
|
7568
7596
|
return __async(this, null, function* () {
|
|
7569
7597
|
let response;
|
|
@@ -7610,7 +7638,6 @@ function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceive
|
|
|
7610
7638
|
};
|
|
7611
7639
|
}
|
|
7612
7640
|
if (data.data != null) {
|
|
7613
|
-
console.log("data: ", JSON.stringify(data.data, null, 2));
|
|
7614
7641
|
const res = parseRouterResponse(data.data, params.byAmountIn);
|
|
7615
7642
|
if (overlayFee > 0 && overlayFeeReceiver !== "0x0") {
|
|
7616
7643
|
if (params.byAmountIn) {
|
|
@@ -7768,4 +7795,4 @@ decimal.js/decimal.mjs:
|
|
|
7768
7795
|
*)
|
|
7769
7796
|
*/
|
|
7770
7797
|
|
|
7771
|
-
export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALPHAFI,
|
|
7798
|
+
export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALPHAFI, AggregatorClient25 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, 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 };
|