@cetusprotocol/aggregator-sdk 1.0.3 → 1.1.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 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -8
- package/dist/index.mjs +6 -8
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -223,7 +223,7 @@ declare class AggregatorConfig {
|
|
|
223
223
|
|
|
224
224
|
declare function getRouterResult(endpoint: string, apiKey: string, params: FindRouterParams, overlayFee: number, overlayFeeReceiver: string): Promise<RouterDataV3 | null>;
|
|
225
225
|
declare function getDeepbookV3Config(endpoint: string): Promise<DeepbookV3ConfigResponse | null>;
|
|
226
|
-
declare function processFlattenRoutes(routerData: RouterDataV3
|
|
226
|
+
declare function processFlattenRoutes(routerData: RouterDataV3): ProcessedRouterData;
|
|
227
227
|
|
|
228
228
|
interface Extends {
|
|
229
229
|
deepbookv3DeepFee?: TransactionObjectArgument;
|
|
@@ -336,7 +336,7 @@ declare class AggregatorClient {
|
|
|
336
336
|
findRouters(params: FindRouterParams): Promise<RouterDataV3 | null>;
|
|
337
337
|
executeFlexibleInputSwap(txb: Transaction, inputCoin: TransactionObjectArgument, routerData: RouterDataV3, expectedAmountOut: string, amountLimit: string, pythPriceIDs: Map<string, string>, partner?: string, deepbookv3DeepFee?: TransactionObjectArgument, packages?: Map<string, string>): Promise<void>;
|
|
338
338
|
newDexRouterV3(provider: string, pythPriceIDs: Map<string, string>, partner?: string): DexRouter;
|
|
339
|
-
expectInputSwapV3(txb: Transaction, inputCoin: TransactionObjectArgument, routerData: RouterDataV3, expectAmountOut: string, amountOutLimit: string, pythPriceIDs: Map<string, string>,
|
|
339
|
+
expectInputSwapV3(txb: Transaction, inputCoin: TransactionObjectArgument, routerData: RouterDataV3, expectAmountOut: string, amountOutLimit: string, pythPriceIDs: Map<string, string>, partner?: string): TransactionObjectArgument;
|
|
340
340
|
expectOutputSwapV3(txb: Transaction, inputCoin: TransactionObjectArgument, routerData: RouterDataV3, amountOut: string, _amountLimit: string, // it will set when build inputcoin
|
|
341
341
|
partner?: string): TransactionObjectArgument;
|
|
342
342
|
routerSwap(params: BuildRouterSwapParamsV3): Promise<TransactionObjectArgument>;
|
package/dist/index.d.ts
CHANGED
|
@@ -223,7 +223,7 @@ declare class AggregatorConfig {
|
|
|
223
223
|
|
|
224
224
|
declare function getRouterResult(endpoint: string, apiKey: string, params: FindRouterParams, overlayFee: number, overlayFeeReceiver: string): Promise<RouterDataV3 | null>;
|
|
225
225
|
declare function getDeepbookV3Config(endpoint: string): Promise<DeepbookV3ConfigResponse | null>;
|
|
226
|
-
declare function processFlattenRoutes(routerData: RouterDataV3
|
|
226
|
+
declare function processFlattenRoutes(routerData: RouterDataV3): ProcessedRouterData;
|
|
227
227
|
|
|
228
228
|
interface Extends {
|
|
229
229
|
deepbookv3DeepFee?: TransactionObjectArgument;
|
|
@@ -336,7 +336,7 @@ declare class AggregatorClient {
|
|
|
336
336
|
findRouters(params: FindRouterParams): Promise<RouterDataV3 | null>;
|
|
337
337
|
executeFlexibleInputSwap(txb: Transaction, inputCoin: TransactionObjectArgument, routerData: RouterDataV3, expectedAmountOut: string, amountLimit: string, pythPriceIDs: Map<string, string>, partner?: string, deepbookv3DeepFee?: TransactionObjectArgument, packages?: Map<string, string>): Promise<void>;
|
|
338
338
|
newDexRouterV3(provider: string, pythPriceIDs: Map<string, string>, partner?: string): DexRouter;
|
|
339
|
-
expectInputSwapV3(txb: Transaction, inputCoin: TransactionObjectArgument, routerData: RouterDataV3, expectAmountOut: string, amountOutLimit: string, pythPriceIDs: Map<string, string>,
|
|
339
|
+
expectInputSwapV3(txb: Transaction, inputCoin: TransactionObjectArgument, routerData: RouterDataV3, expectAmountOut: string, amountOutLimit: string, pythPriceIDs: Map<string, string>, partner?: string): TransactionObjectArgument;
|
|
340
340
|
expectOutputSwapV3(txb: Transaction, inputCoin: TransactionObjectArgument, routerData: RouterDataV3, amountOut: string, _amountLimit: string, // it will set when build inputcoin
|
|
341
341
|
partner?: string): TransactionObjectArgument;
|
|
342
342
|
routerSwap(params: BuildRouterSwapParamsV3): Promise<TransactionObjectArgument>;
|
package/dist/index.js
CHANGED
|
@@ -3426,7 +3426,7 @@ var AGGREGATOR_V3_CONFIG = {
|
|
|
3426
3426
|
};
|
|
3427
3427
|
|
|
3428
3428
|
// src/api.ts
|
|
3429
|
-
var SDK_VERSION =
|
|
3429
|
+
var SDK_VERSION = 1010101;
|
|
3430
3430
|
function parseRouterResponse(data, byAmountIn) {
|
|
3431
3431
|
let packages = /* @__PURE__ */ new Map();
|
|
3432
3432
|
if (data.packages) {
|
|
@@ -3660,7 +3660,7 @@ function getDeepbookV3Config(endpoint) {
|
|
|
3660
3660
|
}
|
|
3661
3661
|
});
|
|
3662
3662
|
}
|
|
3663
|
-
function processFlattenRoutes(routerData
|
|
3663
|
+
function processFlattenRoutes(routerData) {
|
|
3664
3664
|
const paths = routerData.paths;
|
|
3665
3665
|
const fromCoinType = paths[0].from;
|
|
3666
3666
|
const targetCoinType = paths[paths.length - 1].target;
|
|
@@ -3674,11 +3674,12 @@ function processFlattenRoutes(routerData, fixable = false) {
|
|
|
3674
3674
|
const seenTokens = /* @__PURE__ */ new Map();
|
|
3675
3675
|
for (let i = flattenedPaths.length - 1; i >= 0; i--) {
|
|
3676
3676
|
const { from } = flattenedPaths[i].path;
|
|
3677
|
-
if (
|
|
3677
|
+
if (!seenTokens.has(from)) {
|
|
3678
3678
|
seenTokens.set(from, true);
|
|
3679
3679
|
flattenedPaths[i].isLastUseOfIntermediateToken = true;
|
|
3680
3680
|
}
|
|
3681
3681
|
}
|
|
3682
|
+
console.log("flattenedPaths", flattenedPaths);
|
|
3682
3683
|
return {
|
|
3683
3684
|
quoteID: routerData.quoteID || "",
|
|
3684
3685
|
amountIn: routerData.amountIn,
|
|
@@ -8363,11 +8364,11 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
8363
8364
|
);
|
|
8364
8365
|
}
|
|
8365
8366
|
}
|
|
8366
|
-
expectInputSwapV3(txb, inputCoin, routerData, expectAmountOut, amountOutLimit, pythPriceIDs,
|
|
8367
|
+
expectInputSwapV3(txb, inputCoin, routerData, expectAmountOut, amountOutLimit, pythPriceIDs, partner) {
|
|
8367
8368
|
if (routerData.quoteID == null) {
|
|
8368
8369
|
throw new Error(CLIENT_CONFIG.ERRORS.QUOTE_ID_REQUIRED);
|
|
8369
8370
|
}
|
|
8370
|
-
const processedData = processFlattenRoutes(routerData
|
|
8371
|
+
const processedData = processFlattenRoutes(routerData);
|
|
8371
8372
|
const swapCtx = newSwapContext(
|
|
8372
8373
|
{
|
|
8373
8374
|
quoteID: processedData.quoteID,
|
|
@@ -8550,7 +8551,6 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
8550
8551
|
amountOut.toString(),
|
|
8551
8552
|
amountLimit.toString(),
|
|
8552
8553
|
priceInfoObjectIds,
|
|
8553
|
-
fixable,
|
|
8554
8554
|
partner != null ? partner : this.partner
|
|
8555
8555
|
);
|
|
8556
8556
|
} else {
|
|
@@ -8665,8 +8665,6 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
8665
8665
|
expectedAmountOut.toString(),
|
|
8666
8666
|
amountLimit.toString(),
|
|
8667
8667
|
priceInfoObjectIds,
|
|
8668
|
-
true,
|
|
8669
|
-
// fixable
|
|
8670
8668
|
partner != null ? partner : this.partner
|
|
8671
8669
|
);
|
|
8672
8670
|
} else {
|
package/dist/index.mjs
CHANGED
|
@@ -3420,7 +3420,7 @@ var AGGREGATOR_V3_CONFIG = {
|
|
|
3420
3420
|
};
|
|
3421
3421
|
|
|
3422
3422
|
// src/api.ts
|
|
3423
|
-
var SDK_VERSION =
|
|
3423
|
+
var SDK_VERSION = 1010101;
|
|
3424
3424
|
function parseRouterResponse(data, byAmountIn) {
|
|
3425
3425
|
let packages = /* @__PURE__ */ new Map();
|
|
3426
3426
|
if (data.packages) {
|
|
@@ -3654,7 +3654,7 @@ function getDeepbookV3Config(endpoint) {
|
|
|
3654
3654
|
}
|
|
3655
3655
|
});
|
|
3656
3656
|
}
|
|
3657
|
-
function processFlattenRoutes(routerData
|
|
3657
|
+
function processFlattenRoutes(routerData) {
|
|
3658
3658
|
const paths = routerData.paths;
|
|
3659
3659
|
const fromCoinType = paths[0].from;
|
|
3660
3660
|
const targetCoinType = paths[paths.length - 1].target;
|
|
@@ -3668,11 +3668,12 @@ function processFlattenRoutes(routerData, fixable = false) {
|
|
|
3668
3668
|
const seenTokens = /* @__PURE__ */ new Map();
|
|
3669
3669
|
for (let i = flattenedPaths.length - 1; i >= 0; i--) {
|
|
3670
3670
|
const { from } = flattenedPaths[i].path;
|
|
3671
|
-
if (
|
|
3671
|
+
if (!seenTokens.has(from)) {
|
|
3672
3672
|
seenTokens.set(from, true);
|
|
3673
3673
|
flattenedPaths[i].isLastUseOfIntermediateToken = true;
|
|
3674
3674
|
}
|
|
3675
3675
|
}
|
|
3676
|
+
console.log("flattenedPaths", flattenedPaths);
|
|
3676
3677
|
return {
|
|
3677
3678
|
quoteID: routerData.quoteID || "",
|
|
3678
3679
|
amountIn: routerData.amountIn,
|
|
@@ -8357,11 +8358,11 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
8357
8358
|
);
|
|
8358
8359
|
}
|
|
8359
8360
|
}
|
|
8360
|
-
expectInputSwapV3(txb, inputCoin, routerData, expectAmountOut, amountOutLimit, pythPriceIDs,
|
|
8361
|
+
expectInputSwapV3(txb, inputCoin, routerData, expectAmountOut, amountOutLimit, pythPriceIDs, partner) {
|
|
8361
8362
|
if (routerData.quoteID == null) {
|
|
8362
8363
|
throw new Error(CLIENT_CONFIG.ERRORS.QUOTE_ID_REQUIRED);
|
|
8363
8364
|
}
|
|
8364
|
-
const processedData = processFlattenRoutes(routerData
|
|
8365
|
+
const processedData = processFlattenRoutes(routerData);
|
|
8365
8366
|
const swapCtx = newSwapContext(
|
|
8366
8367
|
{
|
|
8367
8368
|
quoteID: processedData.quoteID,
|
|
@@ -8544,7 +8545,6 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
8544
8545
|
amountOut.toString(),
|
|
8545
8546
|
amountLimit.toString(),
|
|
8546
8547
|
priceInfoObjectIds,
|
|
8547
|
-
fixable,
|
|
8548
8548
|
partner != null ? partner : this.partner
|
|
8549
8549
|
);
|
|
8550
8550
|
} else {
|
|
@@ -8659,8 +8659,6 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
8659
8659
|
expectedAmountOut.toString(),
|
|
8660
8660
|
amountLimit.toString(),
|
|
8661
8661
|
priceInfoObjectIds,
|
|
8662
|
-
true,
|
|
8663
|
-
// fixable
|
|
8664
8662
|
partner != null ? partner : this.partner
|
|
8665
8663
|
);
|
|
8666
8664
|
} else {
|