@cetusprotocol/aggregator-sdk 0.5.0 → 0.7.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 +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +166 -22
- package/dist/index.mjs +163 -22
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -84,6 +84,7 @@ declare const STEAMM = "STEAMM";
|
|
|
84
84
|
declare const METASTABLE = "METASTABLE";
|
|
85
85
|
declare const OBRIC = "OBRIC";
|
|
86
86
|
declare const HAWAL = "HAWAL";
|
|
87
|
+
declare const STEAMM_OMM = "STEAMM_OMM";
|
|
87
88
|
declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
88
89
|
type BuildRouterSwapParams = {
|
|
89
90
|
routers: Router[];
|
|
@@ -167,6 +168,7 @@ declare class AggregatorClient {
|
|
|
167
168
|
fastRouterSwap(params: BuildFastRouterSwapParams | BuildFastRouterSwapParamsV2): Promise<void>;
|
|
168
169
|
publishedAtV2(): string;
|
|
169
170
|
publishedAtV2Extend(): string;
|
|
171
|
+
publishedAtV2Extend2(): string;
|
|
170
172
|
deepbookv3DeepFeeType(): string;
|
|
171
173
|
transferOrDestoryCoin(txb: Transaction, coin: TransactionObjectArgument, coinType: string, aggregatorV2PublishedAt: string): void;
|
|
172
174
|
checkCoinThresholdAndMergeCoin(txb: Transaction, coins: TransactionObjectArgument[], coinType: string, expectedAmountOut: string, threshold: string, aggregatorV2ExtendPublishedAt: string): TransactionObjectArgument;
|
|
@@ -183,8 +185,10 @@ declare function parseRouterResponse(data: any, byAmountIn: boolean): RouterData
|
|
|
183
185
|
declare const CLOCK_ADDRESS: string;
|
|
184
186
|
declare const AGGREGATOR_V2 = "aggregator_v2";
|
|
185
187
|
declare const AGGREGATOR_V2_EXTEND = "aggregator_v2_extend";
|
|
188
|
+
declare const AGGREGATOR_V2_EXTEND2 = "aggregator_v2_extend2";
|
|
186
189
|
declare function getAggregatorV2PublishedAt(aggregatorV2PublishedAt: string, packages?: Map<string, string> | Record<string, string>): string;
|
|
187
190
|
declare function getAggregatorV2ExtendPublishedAt(aggregatorV2ExtendPublishedAt: string, packages?: Map<string, string> | Record<string, string>): string;
|
|
191
|
+
declare function getAggregatorV2Extend2PublishedAt(aggregatorV2Extend2PublishedAt: string, packages?: Map<string, string> | Record<string, string>): string;
|
|
188
192
|
interface Dex {
|
|
189
193
|
swap(client: AggregatorClient, ptb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>, deepbookv3DeepFee?: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
190
194
|
}
|
|
@@ -265,6 +269,11 @@ type ExtendedDetails = {
|
|
|
265
269
|
steammBCoinAType?: string;
|
|
266
270
|
steammBCoinBType?: string;
|
|
267
271
|
steammLPToken?: string;
|
|
272
|
+
steammOracleRegistryId?: string;
|
|
273
|
+
steammOraclePythPriceSeedA?: string;
|
|
274
|
+
steammOraclePythPriceSeedB?: string;
|
|
275
|
+
steammOracleIndexA?: number;
|
|
276
|
+
steammOracleIndexB?: number;
|
|
268
277
|
metastablePriceSeed?: string;
|
|
269
278
|
metastableETHPriceSeed?: string;
|
|
270
279
|
metastableWhitelistedAppId?: string;
|
|
@@ -340,4 +349,4 @@ declare enum Env {
|
|
|
340
349
|
Testnet = 1
|
|
341
350
|
}
|
|
342
351
|
|
|
343
|
-
export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, 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, 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, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ declare const STEAMM = "STEAMM";
|
|
|
84
84
|
declare const METASTABLE = "METASTABLE";
|
|
85
85
|
declare const OBRIC = "OBRIC";
|
|
86
86
|
declare const HAWAL = "HAWAL";
|
|
87
|
+
declare const STEAMM_OMM = "STEAMM_OMM";
|
|
87
88
|
declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
88
89
|
type BuildRouterSwapParams = {
|
|
89
90
|
routers: Router[];
|
|
@@ -167,6 +168,7 @@ declare class AggregatorClient {
|
|
|
167
168
|
fastRouterSwap(params: BuildFastRouterSwapParams | BuildFastRouterSwapParamsV2): Promise<void>;
|
|
168
169
|
publishedAtV2(): string;
|
|
169
170
|
publishedAtV2Extend(): string;
|
|
171
|
+
publishedAtV2Extend2(): string;
|
|
170
172
|
deepbookv3DeepFeeType(): string;
|
|
171
173
|
transferOrDestoryCoin(txb: Transaction, coin: TransactionObjectArgument, coinType: string, aggregatorV2PublishedAt: string): void;
|
|
172
174
|
checkCoinThresholdAndMergeCoin(txb: Transaction, coins: TransactionObjectArgument[], coinType: string, expectedAmountOut: string, threshold: string, aggregatorV2ExtendPublishedAt: string): TransactionObjectArgument;
|
|
@@ -183,8 +185,10 @@ declare function parseRouterResponse(data: any, byAmountIn: boolean): RouterData
|
|
|
183
185
|
declare const CLOCK_ADDRESS: string;
|
|
184
186
|
declare const AGGREGATOR_V2 = "aggregator_v2";
|
|
185
187
|
declare const AGGREGATOR_V2_EXTEND = "aggregator_v2_extend";
|
|
188
|
+
declare const AGGREGATOR_V2_EXTEND2 = "aggregator_v2_extend2";
|
|
186
189
|
declare function getAggregatorV2PublishedAt(aggregatorV2PublishedAt: string, packages?: Map<string, string> | Record<string, string>): string;
|
|
187
190
|
declare function getAggregatorV2ExtendPublishedAt(aggregatorV2ExtendPublishedAt: string, packages?: Map<string, string> | Record<string, string>): string;
|
|
191
|
+
declare function getAggregatorV2Extend2PublishedAt(aggregatorV2Extend2PublishedAt: string, packages?: Map<string, string> | Record<string, string>): string;
|
|
188
192
|
interface Dex {
|
|
189
193
|
swap(client: AggregatorClient, ptb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>, deepbookv3DeepFee?: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
190
194
|
}
|
|
@@ -265,6 +269,11 @@ type ExtendedDetails = {
|
|
|
265
269
|
steammBCoinAType?: string;
|
|
266
270
|
steammBCoinBType?: string;
|
|
267
271
|
steammLPToken?: string;
|
|
272
|
+
steammOracleRegistryId?: string;
|
|
273
|
+
steammOraclePythPriceSeedA?: string;
|
|
274
|
+
steammOraclePythPriceSeedB?: string;
|
|
275
|
+
steammOracleIndexA?: number;
|
|
276
|
+
steammOracleIndexB?: number;
|
|
268
277
|
metastablePriceSeed?: string;
|
|
269
278
|
metastableETHPriceSeed?: string;
|
|
270
279
|
metastableWhitelistedAppId?: string;
|
|
@@ -340,4 +349,4 @@ declare enum Env {
|
|
|
340
349
|
Testnet = 1
|
|
341
350
|
}
|
|
342
351
|
|
|
343
|
-
export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, 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, 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, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -6045,12 +6045,12 @@ var Bluemove = class {
|
|
|
6045
6045
|
// src/transaction/deepbook_v3.ts
|
|
6046
6046
|
var DeepbookV3 = class {
|
|
6047
6047
|
constructor(env) {
|
|
6048
|
-
this.deepbookV3Config = env === 0 /* Mainnet */ ? "
|
|
6048
|
+
this.deepbookV3Config = env === 0 /* Mainnet */ ? "0x699d455ab8c5e02075b4345ea1f91be55bf46064ae6026cc2528e701ce3ac135" : "0xe19b5d072346cae83a037d4e3c8492068a74410a74e5830b3a68012db38296aa";
|
|
6049
6049
|
}
|
|
6050
6050
|
swap(client, txb, path, inputCoin, packages, deepbookv3DeepFee) {
|
|
6051
6051
|
return __async(this, null, function* () {
|
|
6052
6052
|
const { direction, from, target } = path;
|
|
6053
|
-
const [func, coinAType, coinBType] = direction ? ["
|
|
6053
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b_v2", from, target] : ["swap_b2a_v2", target, from];
|
|
6054
6054
|
let deepFee;
|
|
6055
6055
|
if (deepbookv3DeepFee) {
|
|
6056
6056
|
deepFee = deepbookv3DeepFee;
|
|
@@ -6249,8 +6249,8 @@ var Alphafi = class {
|
|
|
6249
6249
|
}
|
|
6250
6250
|
};
|
|
6251
6251
|
|
|
6252
|
-
// src/transaction/
|
|
6253
|
-
var
|
|
6252
|
+
// src/transaction/steamm_cpmm.ts
|
|
6253
|
+
var SteammCPMM = class {
|
|
6254
6254
|
constructor(env) {
|
|
6255
6255
|
if (env !== 0 /* Mainnet */) {
|
|
6256
6256
|
throw new Error("Steamm only supported on mainnet");
|
|
@@ -6311,6 +6311,114 @@ var Steamm = class {
|
|
|
6311
6311
|
}
|
|
6312
6312
|
};
|
|
6313
6313
|
|
|
6314
|
+
// src/transaction/steamm_omm.ts
|
|
6315
|
+
var SteammOmm = class {
|
|
6316
|
+
constructor(env, pythPriceIDs) {
|
|
6317
|
+
if (env !== 0 /* Mainnet */) {
|
|
6318
|
+
throw new Error("Steamm only supported on mainnet");
|
|
6319
|
+
}
|
|
6320
|
+
this.pythPriceIDs = pythPriceIDs;
|
|
6321
|
+
this.oraclePackageId = "0xe84b649199654d18c38e727212f5d8dacfc3cf78d60d0a7fc85fd589f280eb2b";
|
|
6322
|
+
}
|
|
6323
|
+
swap(client, txb, path, inputCoin, packages) {
|
|
6324
|
+
return __async(this, null, function* () {
|
|
6325
|
+
const { direction, from, target } = path;
|
|
6326
|
+
if (path.extendedDetails == null) {
|
|
6327
|
+
throw new Error("Extended details not supported");
|
|
6328
|
+
} else {
|
|
6329
|
+
if (path.extendedDetails.steammBankA == null) {
|
|
6330
|
+
throw new Error("Steamm bank a type not supported");
|
|
6331
|
+
}
|
|
6332
|
+
if (path.extendedDetails.steammBankB == null) {
|
|
6333
|
+
throw new Error("Steamm bank b type not supported");
|
|
6334
|
+
}
|
|
6335
|
+
if (path.extendedDetails.steammLendingMarket == null) {
|
|
6336
|
+
throw new Error("Steamm lending market not supported");
|
|
6337
|
+
}
|
|
6338
|
+
if (path.extendedDetails.steammLendingMarketType == null) {
|
|
6339
|
+
throw new Error("Steamm lending market type not supported");
|
|
6340
|
+
}
|
|
6341
|
+
if (path.extendedDetails.steammBCoinAType == null) {
|
|
6342
|
+
throw new Error("Steamm b coin a type not supported");
|
|
6343
|
+
}
|
|
6344
|
+
if (path.extendedDetails.steammBCoinBType == null) {
|
|
6345
|
+
throw new Error("Steamm b coin b type not supported");
|
|
6346
|
+
}
|
|
6347
|
+
if (path.extendedDetails.steammLPToken == null) {
|
|
6348
|
+
throw new Error("Steamm lp token not supported");
|
|
6349
|
+
}
|
|
6350
|
+
if (path.extendedDetails.steammOracleRegistryId == null) {
|
|
6351
|
+
throw new Error("Steamm oracle registry id not supported");
|
|
6352
|
+
}
|
|
6353
|
+
if (path.extendedDetails.steammOracleIndexA == null) {
|
|
6354
|
+
throw new Error("Steamm oracle index a not supported");
|
|
6355
|
+
}
|
|
6356
|
+
if (path.extendedDetails.steammOracleIndexB == null) {
|
|
6357
|
+
throw new Error("Steamm oracle index b not supported");
|
|
6358
|
+
}
|
|
6359
|
+
if (path.extendedDetails.steammOraclePythPriceSeedA == null) {
|
|
6360
|
+
throw new Error("Steamm oracle pyth price seed a not supported");
|
|
6361
|
+
}
|
|
6362
|
+
if (path.extendedDetails.steammOraclePythPriceSeedB == null) {
|
|
6363
|
+
throw new Error("Steamm oracle pyth price seed b not supported");
|
|
6364
|
+
}
|
|
6365
|
+
}
|
|
6366
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
6367
|
+
const priceSeedA = path.extendedDetails.steammOraclePythPriceSeedA;
|
|
6368
|
+
const priceSeedB = path.extendedDetails.steammOraclePythPriceSeedB;
|
|
6369
|
+
const priceInfoObjectIdA = this.pythPriceIDs.get(priceSeedA);
|
|
6370
|
+
const priceInfoObjectIdB = this.pythPriceIDs.get(priceSeedB);
|
|
6371
|
+
if (!priceInfoObjectIdA || !priceInfoObjectIdB) {
|
|
6372
|
+
throw new Error("Base price info object id or quote price info object id not found");
|
|
6373
|
+
}
|
|
6374
|
+
const oraclePriceUpdateA = txb.moveCall({
|
|
6375
|
+
target: `${this.oraclePackageId}::oracles::get_pyth_price`,
|
|
6376
|
+
typeArguments: [],
|
|
6377
|
+
arguments: [
|
|
6378
|
+
txb.object(path.extendedDetails.steammOracleRegistryId),
|
|
6379
|
+
txb.object(priceInfoObjectIdA),
|
|
6380
|
+
txb.pure.u64(path.extendedDetails.steammOracleIndexA),
|
|
6381
|
+
txb.object(CLOCK_ADDRESS)
|
|
6382
|
+
]
|
|
6383
|
+
});
|
|
6384
|
+
const oraclePriceUpdateB = txb.moveCall({
|
|
6385
|
+
target: `${this.oraclePackageId}::oracles::get_pyth_price`,
|
|
6386
|
+
typeArguments: [],
|
|
6387
|
+
arguments: [
|
|
6388
|
+
txb.object(path.extendedDetails.steammOracleRegistryId),
|
|
6389
|
+
txb.object(priceInfoObjectIdB),
|
|
6390
|
+
txb.pure.u64(path.extendedDetails.steammOracleIndexB),
|
|
6391
|
+
txb.object(CLOCK_ADDRESS)
|
|
6392
|
+
]
|
|
6393
|
+
});
|
|
6394
|
+
const args = [
|
|
6395
|
+
txb.object(path.id),
|
|
6396
|
+
txb.object(path.extendedDetails.steammBankA),
|
|
6397
|
+
txb.object(path.extendedDetails.steammBankB),
|
|
6398
|
+
txb.object(path.extendedDetails.steammLendingMarket),
|
|
6399
|
+
oraclePriceUpdateA,
|
|
6400
|
+
oraclePriceUpdateB,
|
|
6401
|
+
inputCoin,
|
|
6402
|
+
txb.object(CLOCK_ADDRESS)
|
|
6403
|
+
];
|
|
6404
|
+
const publishedAt = getAggregatorV2Extend2PublishedAt(client.publishedAtV2Extend2(), packages);
|
|
6405
|
+
const res = txb.moveCall({
|
|
6406
|
+
target: `${publishedAt}::steamm_omm::${func}`,
|
|
6407
|
+
typeArguments: [
|
|
6408
|
+
path.extendedDetails.steammLendingMarketType,
|
|
6409
|
+
coinAType,
|
|
6410
|
+
coinBType,
|
|
6411
|
+
path.extendedDetails.steammBCoinAType,
|
|
6412
|
+
path.extendedDetails.steammBCoinBType,
|
|
6413
|
+
path.extendedDetails.steammLPToken
|
|
6414
|
+
],
|
|
6415
|
+
arguments: args
|
|
6416
|
+
});
|
|
6417
|
+
return res;
|
|
6418
|
+
});
|
|
6419
|
+
}
|
|
6420
|
+
};
|
|
6421
|
+
|
|
6314
6422
|
// src/transaction/metastable.ts
|
|
6315
6423
|
var SUPER_SUI_TYPE = "0x790f258062909e3a0ffc78b3c53ac2f62d7084c3bab95644bdeb05add7250001::super_sui::SUPER_SUI";
|
|
6316
6424
|
var MUSD_TYPE = "0xe44df51c0b21a27ab915fa1fe2ca610cd3eaa6d9666fe5e62b988bf7f0bd8722::musd::MUSD";
|
|
@@ -6537,6 +6645,7 @@ var STEAMM = "STEAMM";
|
|
|
6537
6645
|
var METASTABLE = "METASTABLE";
|
|
6538
6646
|
var OBRIC = "OBRIC";
|
|
6539
6647
|
var HAWAL = "HAWAL";
|
|
6648
|
+
var STEAMM_OMM = "STEAMM_OMM";
|
|
6540
6649
|
var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
6541
6650
|
function isBuilderRouterSwapParams(params) {
|
|
6542
6651
|
return Array.isArray(params.routers);
|
|
@@ -7053,11 +7162,18 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7053
7162
|
// Include deepbookv3, scallop, bluefin
|
|
7054
7163
|
publishedAtV2Extend() {
|
|
7055
7164
|
if (this.env === 0 /* Mainnet */) {
|
|
7056
|
-
return "
|
|
7165
|
+
return "0x39402d188b7231036e52266ebafad14413b4bf3daea4ac17115989444e6cd516";
|
|
7057
7166
|
} else {
|
|
7058
7167
|
return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
|
|
7059
7168
|
}
|
|
7060
7169
|
}
|
|
7170
|
+
publishedAtV2Extend2() {
|
|
7171
|
+
if (this.env === 0 /* Mainnet */) {
|
|
7172
|
+
return "0x368d13376443a8051b22b42a9125f6a3bc836422bb2d9c4a53984b8d6624c326";
|
|
7173
|
+
} else {
|
|
7174
|
+
return "0x0";
|
|
7175
|
+
}
|
|
7176
|
+
}
|
|
7061
7177
|
deepbookv3DeepFeeType() {
|
|
7062
7178
|
if (this.env === 0 /* Mainnet */) {
|
|
7063
7179
|
return "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP";
|
|
@@ -7149,7 +7265,9 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7149
7265
|
case ALPHAFI:
|
|
7150
7266
|
return new Alphafi(this.env);
|
|
7151
7267
|
case STEAMM:
|
|
7152
|
-
return new
|
|
7268
|
+
return new SteammCPMM(this.env);
|
|
7269
|
+
case STEAMM_OMM:
|
|
7270
|
+
return new SteammOmm(this.env, pythPriceIDs);
|
|
7153
7271
|
case METASTABLE:
|
|
7154
7272
|
return new Metastable(this.env, pythPriceIDs);
|
|
7155
7273
|
case OBRIC:
|
|
@@ -7249,7 +7367,7 @@ _AggregatorClient.CONFIG = {
|
|
|
7249
7367
|
pythStateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"
|
|
7250
7368
|
}
|
|
7251
7369
|
};
|
|
7252
|
-
var
|
|
7370
|
+
var AggregatorClient24 = _AggregatorClient;
|
|
7253
7371
|
function findPythPriceIDs(routes) {
|
|
7254
7372
|
const priceIDs = /* @__PURE__ */ new Set();
|
|
7255
7373
|
for (const route of routes) {
|
|
@@ -7276,6 +7394,14 @@ function findPythPriceIDs(routes) {
|
|
|
7276
7394
|
priceIDs.add(path.extendedDetails.obricCoinBPriceSeed);
|
|
7277
7395
|
}
|
|
7278
7396
|
}
|
|
7397
|
+
if (path.provider === STEAMM_OMM) {
|
|
7398
|
+
if (path.extendedDetails && path.extendedDetails.steammOraclePythPriceSeedA) {
|
|
7399
|
+
priceIDs.add(path.extendedDetails.steammOraclePythPriceSeedA);
|
|
7400
|
+
}
|
|
7401
|
+
if (path.extendedDetails && path.extendedDetails.steammOraclePythPriceSeedB) {
|
|
7402
|
+
priceIDs.add(path.extendedDetails.steammOraclePythPriceSeedB);
|
|
7403
|
+
}
|
|
7404
|
+
}
|
|
7279
7405
|
}
|
|
7280
7406
|
}
|
|
7281
7407
|
return Array.from(priceIDs);
|
|
@@ -7304,13 +7430,14 @@ function parseRouterResponse(data, byAmountIn) {
|
|
|
7304
7430
|
routes: data.routes.map((route) => {
|
|
7305
7431
|
return {
|
|
7306
7432
|
path: route.path.map((path) => {
|
|
7307
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
7433
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
|
|
7308
7434
|
let version;
|
|
7309
7435
|
if (path.provider === AFTERMATH) {
|
|
7310
7436
|
version = path.extended_details.aftermath_pool_flatness === 0 ? "v2" : "v3";
|
|
7311
7437
|
}
|
|
7438
|
+
console.log("path: ", path.extended_details);
|
|
7312
7439
|
let extendedDetails;
|
|
7313
|
-
if (path.provider === TURBOS || path.provider === AFTERMATH || path.provider === CETUS || path.provider === DEEPBOOKV3 || path.provider === SCALLOP || path.provider === HAEDALPMM || path.provider ===
|
|
7440
|
+
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) {
|
|
7314
7441
|
extendedDetails = {
|
|
7315
7442
|
aftermathLpSupplyType: (_a = path.extended_details) == null ? void 0 : _a.aftermath_lp_supply_type,
|
|
7316
7443
|
turbosFeeType: (_b = path.extended_details) == null ? void 0 : _b.turbos_fee_type,
|
|
@@ -7326,17 +7453,22 @@ function parseRouterResponse(data, byAmountIn) {
|
|
|
7326
7453
|
steammBCoinAType: (_l = path.extended_details) == null ? void 0 : _l.steamm_btoken_a_type,
|
|
7327
7454
|
steammBCoinBType: (_m = path.extended_details) == null ? void 0 : _m.steamm_btoken_b_type,
|
|
7328
7455
|
steammLPToken: (_n = path.extended_details) == null ? void 0 : _n.steamm_lp_token_type,
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7456
|
+
steammOracleRegistryId: (_o = path.extended_details) == null ? void 0 : _o.steamm_oracle_registry_id,
|
|
7457
|
+
steammOracleIndexA: (_p = path.extended_details) == null ? void 0 : _p.steamm_oracle_index_a,
|
|
7458
|
+
steammOracleIndexB: (_q = path.extended_details) == null ? void 0 : _q.steamm_oracle_index_b,
|
|
7459
|
+
steammOraclePythPriceSeedA: (_r = path.extended_details) == null ? void 0 : _r.steamm_oracle_pyth_price_seed_a,
|
|
7460
|
+
steammOraclePythPriceSeedB: (_s = path.extended_details) == null ? void 0 : _s.steamm_oracle_pyth_price_seed_b,
|
|
7461
|
+
metastablePriceSeed: (_t = path.extended_details) == null ? void 0 : _t.metastable_price_seed,
|
|
7462
|
+
metastableETHPriceSeed: (_u = path.extended_details) == null ? void 0 : _u.metastable_eth_price_seed,
|
|
7463
|
+
metastableWhitelistedAppId: (_v = path.extended_details) == null ? void 0 : _v.metastable_whitelisted_app_id,
|
|
7464
|
+
metastableCreateCapPkgId: (_w = path.extended_details) == null ? void 0 : _w.metastable_create_cap_pkg_id,
|
|
7465
|
+
metastableCreateCapModule: (_x = path.extended_details) == null ? void 0 : _x.metastable_create_cap_module,
|
|
7466
|
+
metastableCreateCapAllTypeParams: (_y = path.extended_details) == null ? void 0 : _y.metastable_create_cap_all_type_params,
|
|
7467
|
+
metastableRegistryId: (_z = path.extended_details) == null ? void 0 : _z.metastable_registry_id,
|
|
7468
|
+
obricCoinAPriceSeed: (_A = path.extended_details) == null ? void 0 : _A.obric_coin_a_price_seed,
|
|
7469
|
+
obricCoinBPriceSeed: (_B = path.extended_details) == null ? void 0 : _B.obric_coin_b_price_seed,
|
|
7470
|
+
obricCoinAPriceId: (_C = path.extended_details) == null ? void 0 : _C.obric_coin_a_price_id,
|
|
7471
|
+
obricCoinBPriceId: (_D = path.extended_details) == null ? void 0 : _D.obric_coin_b_price_id
|
|
7340
7472
|
};
|
|
7341
7473
|
}
|
|
7342
7474
|
return {
|
|
@@ -7365,6 +7497,7 @@ function parseRouterResponse(data, byAmountIn) {
|
|
|
7365
7497
|
var CLOCK_ADDRESS = utils.SUI_CLOCK_OBJECT_ID;
|
|
7366
7498
|
var AGGREGATOR_V2 = "aggregator_v2";
|
|
7367
7499
|
var AGGREGATOR_V2_EXTEND = "aggregator_v2_extend";
|
|
7500
|
+
var AGGREGATOR_V2_EXTEND2 = "aggregator_v2_extend2";
|
|
7368
7501
|
function getAggregatorV2PublishedAt(aggregatorV2PublishedAt, packages) {
|
|
7369
7502
|
var _a;
|
|
7370
7503
|
if (packages instanceof Map) {
|
|
@@ -7379,6 +7512,13 @@ function getAggregatorV2ExtendPublishedAt(aggregatorV2ExtendPublishedAt, package
|
|
|
7379
7512
|
}
|
|
7380
7513
|
return aggregatorV2ExtendPublishedAt;
|
|
7381
7514
|
}
|
|
7515
|
+
function getAggregatorV2Extend2PublishedAt(aggregatorV2Extend2PublishedAt, packages) {
|
|
7516
|
+
var _a;
|
|
7517
|
+
if (packages instanceof Map) {
|
|
7518
|
+
return (_a = packages.get(AGGREGATOR_V2_EXTEND2)) != null ? _a : aggregatorV2Extend2PublishedAt;
|
|
7519
|
+
}
|
|
7520
|
+
return aggregatorV2Extend2PublishedAt;
|
|
7521
|
+
}
|
|
7382
7522
|
|
|
7383
7523
|
// src/utils/msafe.ts
|
|
7384
7524
|
var import_bn6 = __toESM(require_bn());
|
|
@@ -7425,7 +7565,7 @@ function processEndpoint(endpoint) {
|
|
|
7425
7565
|
|
|
7426
7566
|
// src/api.ts
|
|
7427
7567
|
var import_bn7 = __toESM(require_bn());
|
|
7428
|
-
var SDK_VERSION =
|
|
7568
|
+
var SDK_VERSION = 1000700;
|
|
7429
7569
|
function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
|
|
7430
7570
|
return __async(this, null, function* () {
|
|
7431
7571
|
let response;
|
|
@@ -7472,6 +7612,7 @@ function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceive
|
|
|
7472
7612
|
};
|
|
7473
7613
|
}
|
|
7474
7614
|
if (data.data != null) {
|
|
7615
|
+
console.log("data: ", JSON.stringify(data.data, null, 2));
|
|
7475
7616
|
const res = parseRouterResponse(data.data, params.byAmountIn);
|
|
7476
7617
|
if (overlayFee > 0 && overlayFeeReceiver !== "0x0") {
|
|
7477
7618
|
if (params.byAmountIn) {
|
|
@@ -7633,8 +7774,9 @@ exports.AFSUI = AFSUI;
|
|
|
7633
7774
|
exports.AFTERMATH = AFTERMATH;
|
|
7634
7775
|
exports.AGGREGATOR_V2 = AGGREGATOR_V2;
|
|
7635
7776
|
exports.AGGREGATOR_V2_EXTEND = AGGREGATOR_V2_EXTEND;
|
|
7777
|
+
exports.AGGREGATOR_V2_EXTEND2 = AGGREGATOR_V2_EXTEND2;
|
|
7636
7778
|
exports.ALPHAFI = ALPHAFI;
|
|
7637
|
-
exports.AggregatorClient =
|
|
7779
|
+
exports.AggregatorClient = AggregatorClient24;
|
|
7638
7780
|
exports.BLUEFIN = BLUEFIN;
|
|
7639
7781
|
exports.BLUEMOVE = BLUEMOVE;
|
|
7640
7782
|
exports.CETUS = CETUS;
|
|
@@ -7656,6 +7798,7 @@ exports.ONE = ONE;
|
|
|
7656
7798
|
exports.SCALLOP = SCALLOP;
|
|
7657
7799
|
exports.SPRINGSUI = SPRINGSUI;
|
|
7658
7800
|
exports.STEAMM = STEAMM;
|
|
7801
|
+
exports.STEAMM_OMM = STEAMM_OMM;
|
|
7659
7802
|
exports.SUILEND = SUILEND;
|
|
7660
7803
|
exports.TEN_POW_NINE = TEN_POW_NINE;
|
|
7661
7804
|
exports.TURBOS = TURBOS;
|
|
@@ -7676,6 +7819,7 @@ exports.extractAddressFromType = extractAddressFromType;
|
|
|
7676
7819
|
exports.extractStructTagFromType = extractStructTagFromType;
|
|
7677
7820
|
exports.findPythPriceIDs = findPythPriceIDs;
|
|
7678
7821
|
exports.fixSuiObjectId = fixSuiObjectId;
|
|
7822
|
+
exports.getAggregatorV2Extend2PublishedAt = getAggregatorV2Extend2PublishedAt;
|
|
7679
7823
|
exports.getAggregatorV2ExtendPublishedAt = getAggregatorV2ExtendPublishedAt;
|
|
7680
7824
|
exports.getAggregatorV2PublishedAt = getAggregatorV2PublishedAt;
|
|
7681
7825
|
exports.getDeepbookV3Config = getDeepbookV3Config;
|
package/dist/index.mjs
CHANGED
|
@@ -6043,12 +6043,12 @@ var Bluemove = class {
|
|
|
6043
6043
|
// src/transaction/deepbook_v3.ts
|
|
6044
6044
|
var DeepbookV3 = class {
|
|
6045
6045
|
constructor(env) {
|
|
6046
|
-
this.deepbookV3Config = env === 0 /* Mainnet */ ? "
|
|
6046
|
+
this.deepbookV3Config = env === 0 /* Mainnet */ ? "0x699d455ab8c5e02075b4345ea1f91be55bf46064ae6026cc2528e701ce3ac135" : "0xe19b5d072346cae83a037d4e3c8492068a74410a74e5830b3a68012db38296aa";
|
|
6047
6047
|
}
|
|
6048
6048
|
swap(client, txb, path, inputCoin, packages, deepbookv3DeepFee) {
|
|
6049
6049
|
return __async(this, null, function* () {
|
|
6050
6050
|
const { direction, from, target } = path;
|
|
6051
|
-
const [func, coinAType, coinBType] = direction ? ["
|
|
6051
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b_v2", from, target] : ["swap_b2a_v2", target, from];
|
|
6052
6052
|
let deepFee;
|
|
6053
6053
|
if (deepbookv3DeepFee) {
|
|
6054
6054
|
deepFee = deepbookv3DeepFee;
|
|
@@ -6247,8 +6247,8 @@ var Alphafi = class {
|
|
|
6247
6247
|
}
|
|
6248
6248
|
};
|
|
6249
6249
|
|
|
6250
|
-
// src/transaction/
|
|
6251
|
-
var
|
|
6250
|
+
// src/transaction/steamm_cpmm.ts
|
|
6251
|
+
var SteammCPMM = class {
|
|
6252
6252
|
constructor(env) {
|
|
6253
6253
|
if (env !== 0 /* Mainnet */) {
|
|
6254
6254
|
throw new Error("Steamm only supported on mainnet");
|
|
@@ -6309,6 +6309,114 @@ var Steamm = class {
|
|
|
6309
6309
|
}
|
|
6310
6310
|
};
|
|
6311
6311
|
|
|
6312
|
+
// src/transaction/steamm_omm.ts
|
|
6313
|
+
var SteammOmm = class {
|
|
6314
|
+
constructor(env, pythPriceIDs) {
|
|
6315
|
+
if (env !== 0 /* Mainnet */) {
|
|
6316
|
+
throw new Error("Steamm only supported on mainnet");
|
|
6317
|
+
}
|
|
6318
|
+
this.pythPriceIDs = pythPriceIDs;
|
|
6319
|
+
this.oraclePackageId = "0xe84b649199654d18c38e727212f5d8dacfc3cf78d60d0a7fc85fd589f280eb2b";
|
|
6320
|
+
}
|
|
6321
|
+
swap(client, txb, path, inputCoin, packages) {
|
|
6322
|
+
return __async(this, null, function* () {
|
|
6323
|
+
const { direction, from, target } = path;
|
|
6324
|
+
if (path.extendedDetails == null) {
|
|
6325
|
+
throw new Error("Extended details not supported");
|
|
6326
|
+
} else {
|
|
6327
|
+
if (path.extendedDetails.steammBankA == null) {
|
|
6328
|
+
throw new Error("Steamm bank a type not supported");
|
|
6329
|
+
}
|
|
6330
|
+
if (path.extendedDetails.steammBankB == null) {
|
|
6331
|
+
throw new Error("Steamm bank b type not supported");
|
|
6332
|
+
}
|
|
6333
|
+
if (path.extendedDetails.steammLendingMarket == null) {
|
|
6334
|
+
throw new Error("Steamm lending market not supported");
|
|
6335
|
+
}
|
|
6336
|
+
if (path.extendedDetails.steammLendingMarketType == null) {
|
|
6337
|
+
throw new Error("Steamm lending market type not supported");
|
|
6338
|
+
}
|
|
6339
|
+
if (path.extendedDetails.steammBCoinAType == null) {
|
|
6340
|
+
throw new Error("Steamm b coin a type not supported");
|
|
6341
|
+
}
|
|
6342
|
+
if (path.extendedDetails.steammBCoinBType == null) {
|
|
6343
|
+
throw new Error("Steamm b coin b type not supported");
|
|
6344
|
+
}
|
|
6345
|
+
if (path.extendedDetails.steammLPToken == null) {
|
|
6346
|
+
throw new Error("Steamm lp token not supported");
|
|
6347
|
+
}
|
|
6348
|
+
if (path.extendedDetails.steammOracleRegistryId == null) {
|
|
6349
|
+
throw new Error("Steamm oracle registry id not supported");
|
|
6350
|
+
}
|
|
6351
|
+
if (path.extendedDetails.steammOracleIndexA == null) {
|
|
6352
|
+
throw new Error("Steamm oracle index a not supported");
|
|
6353
|
+
}
|
|
6354
|
+
if (path.extendedDetails.steammOracleIndexB == null) {
|
|
6355
|
+
throw new Error("Steamm oracle index b not supported");
|
|
6356
|
+
}
|
|
6357
|
+
if (path.extendedDetails.steammOraclePythPriceSeedA == null) {
|
|
6358
|
+
throw new Error("Steamm oracle pyth price seed a not supported");
|
|
6359
|
+
}
|
|
6360
|
+
if (path.extendedDetails.steammOraclePythPriceSeedB == null) {
|
|
6361
|
+
throw new Error("Steamm oracle pyth price seed b not supported");
|
|
6362
|
+
}
|
|
6363
|
+
}
|
|
6364
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
6365
|
+
const priceSeedA = path.extendedDetails.steammOraclePythPriceSeedA;
|
|
6366
|
+
const priceSeedB = path.extendedDetails.steammOraclePythPriceSeedB;
|
|
6367
|
+
const priceInfoObjectIdA = this.pythPriceIDs.get(priceSeedA);
|
|
6368
|
+
const priceInfoObjectIdB = this.pythPriceIDs.get(priceSeedB);
|
|
6369
|
+
if (!priceInfoObjectIdA || !priceInfoObjectIdB) {
|
|
6370
|
+
throw new Error("Base price info object id or quote price info object id not found");
|
|
6371
|
+
}
|
|
6372
|
+
const oraclePriceUpdateA = txb.moveCall({
|
|
6373
|
+
target: `${this.oraclePackageId}::oracles::get_pyth_price`,
|
|
6374
|
+
typeArguments: [],
|
|
6375
|
+
arguments: [
|
|
6376
|
+
txb.object(path.extendedDetails.steammOracleRegistryId),
|
|
6377
|
+
txb.object(priceInfoObjectIdA),
|
|
6378
|
+
txb.pure.u64(path.extendedDetails.steammOracleIndexA),
|
|
6379
|
+
txb.object(CLOCK_ADDRESS)
|
|
6380
|
+
]
|
|
6381
|
+
});
|
|
6382
|
+
const oraclePriceUpdateB = txb.moveCall({
|
|
6383
|
+
target: `${this.oraclePackageId}::oracles::get_pyth_price`,
|
|
6384
|
+
typeArguments: [],
|
|
6385
|
+
arguments: [
|
|
6386
|
+
txb.object(path.extendedDetails.steammOracleRegistryId),
|
|
6387
|
+
txb.object(priceInfoObjectIdB),
|
|
6388
|
+
txb.pure.u64(path.extendedDetails.steammOracleIndexB),
|
|
6389
|
+
txb.object(CLOCK_ADDRESS)
|
|
6390
|
+
]
|
|
6391
|
+
});
|
|
6392
|
+
const args = [
|
|
6393
|
+
txb.object(path.id),
|
|
6394
|
+
txb.object(path.extendedDetails.steammBankA),
|
|
6395
|
+
txb.object(path.extendedDetails.steammBankB),
|
|
6396
|
+
txb.object(path.extendedDetails.steammLendingMarket),
|
|
6397
|
+
oraclePriceUpdateA,
|
|
6398
|
+
oraclePriceUpdateB,
|
|
6399
|
+
inputCoin,
|
|
6400
|
+
txb.object(CLOCK_ADDRESS)
|
|
6401
|
+
];
|
|
6402
|
+
const publishedAt = getAggregatorV2Extend2PublishedAt(client.publishedAtV2Extend2(), packages);
|
|
6403
|
+
const res = txb.moveCall({
|
|
6404
|
+
target: `${publishedAt}::steamm_omm::${func}`,
|
|
6405
|
+
typeArguments: [
|
|
6406
|
+
path.extendedDetails.steammLendingMarketType,
|
|
6407
|
+
coinAType,
|
|
6408
|
+
coinBType,
|
|
6409
|
+
path.extendedDetails.steammBCoinAType,
|
|
6410
|
+
path.extendedDetails.steammBCoinBType,
|
|
6411
|
+
path.extendedDetails.steammLPToken
|
|
6412
|
+
],
|
|
6413
|
+
arguments: args
|
|
6414
|
+
});
|
|
6415
|
+
return res;
|
|
6416
|
+
});
|
|
6417
|
+
}
|
|
6418
|
+
};
|
|
6419
|
+
|
|
6312
6420
|
// src/transaction/metastable.ts
|
|
6313
6421
|
var SUPER_SUI_TYPE = "0x790f258062909e3a0ffc78b3c53ac2f62d7084c3bab95644bdeb05add7250001::super_sui::SUPER_SUI";
|
|
6314
6422
|
var MUSD_TYPE = "0xe44df51c0b21a27ab915fa1fe2ca610cd3eaa6d9666fe5e62b988bf7f0bd8722::musd::MUSD";
|
|
@@ -6535,6 +6643,7 @@ var STEAMM = "STEAMM";
|
|
|
6535
6643
|
var METASTABLE = "METASTABLE";
|
|
6536
6644
|
var OBRIC = "OBRIC";
|
|
6537
6645
|
var HAWAL = "HAWAL";
|
|
6646
|
+
var STEAMM_OMM = "STEAMM_OMM";
|
|
6538
6647
|
var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
6539
6648
|
function isBuilderRouterSwapParams(params) {
|
|
6540
6649
|
return Array.isArray(params.routers);
|
|
@@ -7051,11 +7160,18 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7051
7160
|
// Include deepbookv3, scallop, bluefin
|
|
7052
7161
|
publishedAtV2Extend() {
|
|
7053
7162
|
if (this.env === 0 /* Mainnet */) {
|
|
7054
|
-
return "
|
|
7163
|
+
return "0x39402d188b7231036e52266ebafad14413b4bf3daea4ac17115989444e6cd516";
|
|
7055
7164
|
} else {
|
|
7056
7165
|
return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
|
|
7057
7166
|
}
|
|
7058
7167
|
}
|
|
7168
|
+
publishedAtV2Extend2() {
|
|
7169
|
+
if (this.env === 0 /* Mainnet */) {
|
|
7170
|
+
return "0x368d13376443a8051b22b42a9125f6a3bc836422bb2d9c4a53984b8d6624c326";
|
|
7171
|
+
} else {
|
|
7172
|
+
return "0x0";
|
|
7173
|
+
}
|
|
7174
|
+
}
|
|
7059
7175
|
deepbookv3DeepFeeType() {
|
|
7060
7176
|
if (this.env === 0 /* Mainnet */) {
|
|
7061
7177
|
return "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP";
|
|
@@ -7147,7 +7263,9 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7147
7263
|
case ALPHAFI:
|
|
7148
7264
|
return new Alphafi(this.env);
|
|
7149
7265
|
case STEAMM:
|
|
7150
|
-
return new
|
|
7266
|
+
return new SteammCPMM(this.env);
|
|
7267
|
+
case STEAMM_OMM:
|
|
7268
|
+
return new SteammOmm(this.env, pythPriceIDs);
|
|
7151
7269
|
case METASTABLE:
|
|
7152
7270
|
return new Metastable(this.env, pythPriceIDs);
|
|
7153
7271
|
case OBRIC:
|
|
@@ -7247,7 +7365,7 @@ _AggregatorClient.CONFIG = {
|
|
|
7247
7365
|
pythStateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"
|
|
7248
7366
|
}
|
|
7249
7367
|
};
|
|
7250
|
-
var
|
|
7368
|
+
var AggregatorClient24 = _AggregatorClient;
|
|
7251
7369
|
function findPythPriceIDs(routes) {
|
|
7252
7370
|
const priceIDs = /* @__PURE__ */ new Set();
|
|
7253
7371
|
for (const route of routes) {
|
|
@@ -7274,6 +7392,14 @@ function findPythPriceIDs(routes) {
|
|
|
7274
7392
|
priceIDs.add(path.extendedDetails.obricCoinBPriceSeed);
|
|
7275
7393
|
}
|
|
7276
7394
|
}
|
|
7395
|
+
if (path.provider === STEAMM_OMM) {
|
|
7396
|
+
if (path.extendedDetails && path.extendedDetails.steammOraclePythPriceSeedA) {
|
|
7397
|
+
priceIDs.add(path.extendedDetails.steammOraclePythPriceSeedA);
|
|
7398
|
+
}
|
|
7399
|
+
if (path.extendedDetails && path.extendedDetails.steammOraclePythPriceSeedB) {
|
|
7400
|
+
priceIDs.add(path.extendedDetails.steammOraclePythPriceSeedB);
|
|
7401
|
+
}
|
|
7402
|
+
}
|
|
7277
7403
|
}
|
|
7278
7404
|
}
|
|
7279
7405
|
return Array.from(priceIDs);
|
|
@@ -7302,13 +7428,14 @@ function parseRouterResponse(data, byAmountIn) {
|
|
|
7302
7428
|
routes: data.routes.map((route) => {
|
|
7303
7429
|
return {
|
|
7304
7430
|
path: route.path.map((path) => {
|
|
7305
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
7431
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
|
|
7306
7432
|
let version;
|
|
7307
7433
|
if (path.provider === AFTERMATH) {
|
|
7308
7434
|
version = path.extended_details.aftermath_pool_flatness === 0 ? "v2" : "v3";
|
|
7309
7435
|
}
|
|
7436
|
+
console.log("path: ", path.extended_details);
|
|
7310
7437
|
let extendedDetails;
|
|
7311
|
-
if (path.provider === TURBOS || path.provider === AFTERMATH || path.provider === CETUS || path.provider === DEEPBOOKV3 || path.provider === SCALLOP || path.provider === HAEDALPMM || path.provider ===
|
|
7438
|
+
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) {
|
|
7312
7439
|
extendedDetails = {
|
|
7313
7440
|
aftermathLpSupplyType: (_a = path.extended_details) == null ? void 0 : _a.aftermath_lp_supply_type,
|
|
7314
7441
|
turbosFeeType: (_b = path.extended_details) == null ? void 0 : _b.turbos_fee_type,
|
|
@@ -7324,17 +7451,22 @@ function parseRouterResponse(data, byAmountIn) {
|
|
|
7324
7451
|
steammBCoinAType: (_l = path.extended_details) == null ? void 0 : _l.steamm_btoken_a_type,
|
|
7325
7452
|
steammBCoinBType: (_m = path.extended_details) == null ? void 0 : _m.steamm_btoken_b_type,
|
|
7326
7453
|
steammLPToken: (_n = path.extended_details) == null ? void 0 : _n.steamm_lp_token_type,
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7454
|
+
steammOracleRegistryId: (_o = path.extended_details) == null ? void 0 : _o.steamm_oracle_registry_id,
|
|
7455
|
+
steammOracleIndexA: (_p = path.extended_details) == null ? void 0 : _p.steamm_oracle_index_a,
|
|
7456
|
+
steammOracleIndexB: (_q = path.extended_details) == null ? void 0 : _q.steamm_oracle_index_b,
|
|
7457
|
+
steammOraclePythPriceSeedA: (_r = path.extended_details) == null ? void 0 : _r.steamm_oracle_pyth_price_seed_a,
|
|
7458
|
+
steammOraclePythPriceSeedB: (_s = path.extended_details) == null ? void 0 : _s.steamm_oracle_pyth_price_seed_b,
|
|
7459
|
+
metastablePriceSeed: (_t = path.extended_details) == null ? void 0 : _t.metastable_price_seed,
|
|
7460
|
+
metastableETHPriceSeed: (_u = path.extended_details) == null ? void 0 : _u.metastable_eth_price_seed,
|
|
7461
|
+
metastableWhitelistedAppId: (_v = path.extended_details) == null ? void 0 : _v.metastable_whitelisted_app_id,
|
|
7462
|
+
metastableCreateCapPkgId: (_w = path.extended_details) == null ? void 0 : _w.metastable_create_cap_pkg_id,
|
|
7463
|
+
metastableCreateCapModule: (_x = path.extended_details) == null ? void 0 : _x.metastable_create_cap_module,
|
|
7464
|
+
metastableCreateCapAllTypeParams: (_y = path.extended_details) == null ? void 0 : _y.metastable_create_cap_all_type_params,
|
|
7465
|
+
metastableRegistryId: (_z = path.extended_details) == null ? void 0 : _z.metastable_registry_id,
|
|
7466
|
+
obricCoinAPriceSeed: (_A = path.extended_details) == null ? void 0 : _A.obric_coin_a_price_seed,
|
|
7467
|
+
obricCoinBPriceSeed: (_B = path.extended_details) == null ? void 0 : _B.obric_coin_b_price_seed,
|
|
7468
|
+
obricCoinAPriceId: (_C = path.extended_details) == null ? void 0 : _C.obric_coin_a_price_id,
|
|
7469
|
+
obricCoinBPriceId: (_D = path.extended_details) == null ? void 0 : _D.obric_coin_b_price_id
|
|
7338
7470
|
};
|
|
7339
7471
|
}
|
|
7340
7472
|
return {
|
|
@@ -7363,6 +7495,7 @@ function parseRouterResponse(data, byAmountIn) {
|
|
|
7363
7495
|
var CLOCK_ADDRESS = SUI_CLOCK_OBJECT_ID;
|
|
7364
7496
|
var AGGREGATOR_V2 = "aggregator_v2";
|
|
7365
7497
|
var AGGREGATOR_V2_EXTEND = "aggregator_v2_extend";
|
|
7498
|
+
var AGGREGATOR_V2_EXTEND2 = "aggregator_v2_extend2";
|
|
7366
7499
|
function getAggregatorV2PublishedAt(aggregatorV2PublishedAt, packages) {
|
|
7367
7500
|
var _a;
|
|
7368
7501
|
if (packages instanceof Map) {
|
|
@@ -7377,6 +7510,13 @@ function getAggregatorV2ExtendPublishedAt(aggregatorV2ExtendPublishedAt, package
|
|
|
7377
7510
|
}
|
|
7378
7511
|
return aggregatorV2ExtendPublishedAt;
|
|
7379
7512
|
}
|
|
7513
|
+
function getAggregatorV2Extend2PublishedAt(aggregatorV2Extend2PublishedAt, packages) {
|
|
7514
|
+
var _a;
|
|
7515
|
+
if (packages instanceof Map) {
|
|
7516
|
+
return (_a = packages.get(AGGREGATOR_V2_EXTEND2)) != null ? _a : aggregatorV2Extend2PublishedAt;
|
|
7517
|
+
}
|
|
7518
|
+
return aggregatorV2Extend2PublishedAt;
|
|
7519
|
+
}
|
|
7380
7520
|
|
|
7381
7521
|
// src/utils/msafe.ts
|
|
7382
7522
|
var import_bn6 = __toESM(require_bn());
|
|
@@ -7423,7 +7563,7 @@ function processEndpoint(endpoint) {
|
|
|
7423
7563
|
|
|
7424
7564
|
// src/api.ts
|
|
7425
7565
|
var import_bn7 = __toESM(require_bn());
|
|
7426
|
-
var SDK_VERSION =
|
|
7566
|
+
var SDK_VERSION = 1000700;
|
|
7427
7567
|
function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
|
|
7428
7568
|
return __async(this, null, function* () {
|
|
7429
7569
|
let response;
|
|
@@ -7470,6 +7610,7 @@ function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceive
|
|
|
7470
7610
|
};
|
|
7471
7611
|
}
|
|
7472
7612
|
if (data.data != null) {
|
|
7613
|
+
console.log("data: ", JSON.stringify(data.data, null, 2));
|
|
7473
7614
|
const res = parseRouterResponse(data.data, params.byAmountIn);
|
|
7474
7615
|
if (overlayFee > 0 && overlayFeeReceiver !== "0x0") {
|
|
7475
7616
|
if (params.byAmountIn) {
|
|
@@ -7627,4 +7768,4 @@ decimal.js/decimal.mjs:
|
|
|
7627
7768
|
*)
|
|
7628
7769
|
*/
|
|
7629
7770
|
|
|
7630
|
-
export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, ALPHAFI,
|
|
7771
|
+
export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALPHAFI, AggregatorClient24 as AggregatorClient, BLUEFIN, BLUEMOVE, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, Env, FLOWXV2, FLOWXV3, HAEDAL, HAEDALPMM, HAWAL, KRIYA, KRIYAV3, METASTABLE, 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 };
|