@cetusprotocol/aggregator-sdk 0.3.17 → 0.3.18
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 +33 -11
- package/dist/index.d.ts +33 -11
- package/dist/index.js +205 -88
- package/dist/index.mjs +200 -88
- package/dist/src/api.d.ts +2 -0
- package/dist/src/client.d.ts +25 -9
- package/dist/src/transaction/afsui.d.ts +1 -1
- package/dist/src/transaction/aftermath.d.ts +1 -1
- package/dist/src/transaction/alphafi.d.ts +7 -0
- package/dist/src/transaction/bluefin.d.ts +1 -1
- package/dist/src/transaction/bluemove.d.ts +1 -1
- package/dist/src/transaction/cetus.d.ts +3 -3
- package/dist/src/transaction/deepbook_v2.d.ts +1 -1
- package/dist/src/transaction/deepbook_v3.d.ts +1 -1
- package/dist/src/transaction/flowx_v2.d.ts +1 -1
- package/dist/src/transaction/flowx_v3.d.ts +1 -1
- package/dist/src/transaction/haedal.d.ts +1 -1
- package/dist/src/transaction/haedal_pmm.d.ts +1 -1
- package/dist/src/transaction/index.d.ts +5 -1
- package/dist/src/transaction/kriya_v2.d.ts +1 -1
- package/dist/src/transaction/kriya_v3.d.ts +1 -1
- package/dist/src/transaction/scallop.d.ts +1 -1
- package/dist/src/transaction/suilend.d.ts +1 -2
- package/dist/src/transaction/turbos.d.ts +1 -1
- package/dist/src/transaction/volo.d.ts +1 -1
- package/package.json +1 -1
- package/src/api.ts +7 -3
- package/src/client.ts +129 -42
- package/src/transaction/afsui.ts +6 -3
- package/src/transaction/aftermath.ts +6 -3
- package/src/transaction/alphafi.ts +50 -0
- package/src/transaction/bluefin.ts +6 -3
- package/src/transaction/bluemove.ts +5 -4
- package/src/transaction/cetus.ts +13 -7
- package/src/transaction/deepbook_v2.ts +5 -4
- package/src/transaction/deepbook_v3.ts +5 -3
- package/src/transaction/flowx_v2.ts +5 -4
- package/src/transaction/flowx_v3.ts +5 -3
- package/src/transaction/haedal.ts +5 -3
- package/src/transaction/haedal_pmm.ts +5 -3
- package/src/transaction/index.ts +20 -1
- package/src/transaction/kriya_v2.ts +5 -4
- package/src/transaction/kriya_v3.ts +5 -4
- package/src/transaction/scallop.ts +5 -4
- package/src/transaction/suilend.ts +6 -10
- package/src/transaction/swap.ts +1 -0
- package/src/transaction/turbos.ts +5 -4
- package/src/transaction/volo.ts +5 -3
- package/src/utils/coin.ts +15 -7
- package/tests/router.test.ts +12 -19
package/dist/src/api.d.ts
CHANGED
|
@@ -53,8 +53,10 @@ export type RouterError = {
|
|
|
53
53
|
export type RouterData = {
|
|
54
54
|
amountIn: BN;
|
|
55
55
|
amountOut: BN;
|
|
56
|
+
byAmountIn: boolean;
|
|
56
57
|
routes: Router[];
|
|
57
58
|
insufficientLiquidity: boolean;
|
|
59
|
+
packages?: Map<string, string>;
|
|
58
60
|
totalDeepFee?: number;
|
|
59
61
|
error?: RouterError;
|
|
60
62
|
};
|
package/dist/src/client.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare const SCALLOP = "SCALLOP";
|
|
|
21
21
|
export declare const SUILEND = "SUILEND";
|
|
22
22
|
export declare const BLUEFIN = "BLUEFIN";
|
|
23
23
|
export declare const HAEDALPMM = "HAEDALPMM";
|
|
24
|
+
export declare const ALPHAFI = "ALPHAFI";
|
|
24
25
|
export declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
|
|
25
26
|
export type BuildRouterSwapParams = {
|
|
26
27
|
routers: Router[];
|
|
@@ -37,7 +38,22 @@ export type BuildFastRouterSwapParams = {
|
|
|
37
38
|
slippage: number;
|
|
38
39
|
txb: Transaction;
|
|
39
40
|
partner?: string;
|
|
40
|
-
|
|
41
|
+
refreshAllCoins?: boolean;
|
|
42
|
+
payDeepFeeAmount?: number;
|
|
43
|
+
};
|
|
44
|
+
export type BuildRouterSwapParamsV2 = {
|
|
45
|
+
routers: RouterData;
|
|
46
|
+
inputCoin: TransactionObjectArgument;
|
|
47
|
+
slippage: number;
|
|
48
|
+
txb: Transaction;
|
|
49
|
+
partner?: string;
|
|
50
|
+
deepbookv3DeepFee?: TransactionObjectArgument;
|
|
51
|
+
};
|
|
52
|
+
export type BuildFastRouterSwapParamsV2 = {
|
|
53
|
+
routers: RouterData;
|
|
54
|
+
slippage: number;
|
|
55
|
+
txb: Transaction;
|
|
56
|
+
partner?: string;
|
|
41
57
|
refreshAllCoins?: boolean;
|
|
42
58
|
payDeepFeeAmount?: number;
|
|
43
59
|
};
|
|
@@ -61,20 +77,20 @@ export declare class AggregatorClient {
|
|
|
61
77
|
constructor(endpoint?: string, signer?: string, client?: SuiClient, env?: Env);
|
|
62
78
|
getCoins(coinType: string, refresh?: boolean): Promise<CoinAsset[]>;
|
|
63
79
|
findRouters(params: FindRouterParams): Promise<RouterData | null>;
|
|
64
|
-
expectInputSwap(txb: Transaction, inputCoin: TransactionObjectArgument, routers: Router[], amountOutLimit: BN, partner?: string, deepbookv3DeepFee?: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
65
|
-
expectOutputSwap(txb: Transaction, inputCoin: TransactionObjectArgument, routers: Router[], partner?: string): Promise<TransactionObjectArgument>;
|
|
80
|
+
expectInputSwap(txb: Transaction, inputCoin: TransactionObjectArgument, routers: Router[], amountOutLimit: BN, partner?: string, deepbookv3DeepFee?: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
|
|
81
|
+
expectOutputSwap(txb: Transaction, inputCoin: TransactionObjectArgument, routers: Router[], partner?: string, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
|
|
66
82
|
swapInPools(params: SwapInPoolsParams): Promise<SwapInPoolsResult | null>;
|
|
67
|
-
routerSwap(params: BuildRouterSwapParams): Promise<TransactionObjectArgument>;
|
|
68
|
-
fastRouterSwap(params: BuildFastRouterSwapParams): Promise<void>;
|
|
69
|
-
publishedAt(): string;
|
|
83
|
+
routerSwap(params: BuildRouterSwapParams | BuildRouterSwapParamsV2): Promise<TransactionObjectArgument>;
|
|
84
|
+
fastRouterSwap(params: BuildFastRouterSwapParams | BuildFastRouterSwapParamsV2): Promise<void>;
|
|
70
85
|
publishedAtV2(): string;
|
|
86
|
+
publishedAtV2Extend(): string;
|
|
71
87
|
deepbookv3DeepFeeType(): string;
|
|
72
|
-
transferOrDestoryCoin(txb: Transaction, coin: TransactionObjectArgument, coinType: string): void;
|
|
73
|
-
checkCoinThresholdAndMergeCoin(txb: Transaction, coins: TransactionObjectArgument[], coinType: string, amountLimit: BN): TransactionObjectArgument;
|
|
88
|
+
transferOrDestoryCoin(txb: Transaction, coin: TransactionObjectArgument, coinType: string, aggregatorV2PublishedAt: string): void;
|
|
89
|
+
checkCoinThresholdAndMergeCoin(txb: Transaction, coins: TransactionObjectArgument[], coinType: string, amountLimit: BN, aggregatorV2PublishedAt: string): TransactionObjectArgument;
|
|
74
90
|
newDex(provider: string, partner?: string): Dex;
|
|
75
91
|
signAndExecuteTransaction(txb: Transaction, signer: Signer): Promise<import("@mysten/sui/client").SuiTransactionBlockResponse>;
|
|
76
92
|
devInspectTransactionBlock(txb: Transaction): Promise<import("@mysten/sui/client").DevInspectResults>;
|
|
77
93
|
sendTransaction(txb: Transaction, signer: Signer): Promise<import("@mysten/sui/client").SuiTransactionBlockResponse>;
|
|
78
94
|
getDeepbookV3Config(): Promise<DeepbookV3Config | null>;
|
|
79
95
|
}
|
|
80
|
-
export declare function parseRouterResponse(data: any): RouterData;
|
|
96
|
+
export declare function parseRouterResponse(data: any, byAmountIn: boolean): RouterData;
|
|
@@ -6,5 +6,5 @@ export declare class Afsui implements Dex {
|
|
|
6
6
|
private referVault;
|
|
7
7
|
private validator;
|
|
8
8
|
constructor(env: Env);
|
|
9
|
-
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
9
|
+
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
|
|
10
10
|
}
|
|
@@ -9,5 +9,5 @@ export declare class Aftermath implements Dex {
|
|
|
9
9
|
private referrealVault;
|
|
10
10
|
constructor(env: Env);
|
|
11
11
|
amountLimit(exportAmountOut: string): string;
|
|
12
|
-
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
12
|
+
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
|
|
13
13
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
2
|
+
import { AggregatorClient, Dex, Env, Path } from "..";
|
|
3
|
+
export declare class Alphafi implements Dex {
|
|
4
|
+
private sui_system_state;
|
|
5
|
+
constructor(env: Env);
|
|
6
|
+
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
|
|
7
|
+
}
|
|
@@ -3,5 +3,5 @@ import { AggregatorClient, Dex, Env, Path } from "..";
|
|
|
3
3
|
export declare class Bluefin implements Dex {
|
|
4
4
|
private globalConfig;
|
|
5
5
|
constructor(env: Env);
|
|
6
|
-
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
6
|
+
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
|
|
7
7
|
}
|
|
@@ -3,5 +3,5 @@ import { AggregatorClient, Dex, Env, Path } from "..";
|
|
|
3
3
|
export declare class Bluemove implements Dex {
|
|
4
4
|
private dexInfo;
|
|
5
5
|
constructor(env: Env);
|
|
6
|
-
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
6
|
+
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
|
|
7
7
|
}
|
|
@@ -9,7 +9,7 @@ export declare class Cetus implements Dex {
|
|
|
9
9
|
private globalConfig;
|
|
10
10
|
private partner;
|
|
11
11
|
constructor(env: Env, partner?: string);
|
|
12
|
-
flash_swap(client: AggregatorClient, txb: Transaction, path: Path, by_amount_in: boolean): CetusFlashSwapResult;
|
|
13
|
-
repay_flash_swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, receipt: TransactionArgument): TransactionObjectArgument;
|
|
14
|
-
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
12
|
+
flash_swap(client: AggregatorClient, txb: Transaction, path: Path, by_amount_in: boolean, packages?: Map<string, string>): CetusFlashSwapResult;
|
|
13
|
+
repay_flash_swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, receipt: TransactionArgument, packages?: Map<string, string>): TransactionObjectArgument;
|
|
14
|
+
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
|
|
15
15
|
}
|
|
@@ -9,6 +9,6 @@ export declare class DeepbookV2 implements Dex {
|
|
|
9
9
|
constructor(env: Env);
|
|
10
10
|
getAccountCap(client: SuiClient, owner: string): Promise<string | null>;
|
|
11
11
|
getOrCreateAccountCap(txb: Transaction, client: SuiClient, owner: string): Promise<GetOrCreateAccountCapResult>;
|
|
12
|
-
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
12
|
+
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
@@ -8,5 +8,5 @@ export type CetusFlashSwapResult = {
|
|
|
8
8
|
export declare class DeepbookV3 implements Dex {
|
|
9
9
|
private deepbookV3Config;
|
|
10
10
|
constructor(env: Env);
|
|
11
|
-
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, deepbookv3DeepFee?: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
11
|
+
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>, deepbookv3DeepFee?: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
12
12
|
}
|
|
@@ -3,5 +3,5 @@ import { AggregatorClient, Dex, Env, Path } from "..";
|
|
|
3
3
|
export declare class FlowxV2 implements Dex {
|
|
4
4
|
private container;
|
|
5
5
|
constructor(env: Env);
|
|
6
|
-
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
6
|
+
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
|
|
7
7
|
}
|
|
@@ -4,5 +4,5 @@ export declare class FlowxV3 implements Dex {
|
|
|
4
4
|
private versioned;
|
|
5
5
|
private poolRegistry;
|
|
6
6
|
constructor(env: Env);
|
|
7
|
-
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
7
|
+
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
|
|
8
8
|
}
|
|
@@ -2,5 +2,5 @@ import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions
|
|
|
2
2
|
import { AggregatorClient, Dex, Env, Path } from "..";
|
|
3
3
|
export declare class Haedal implements Dex {
|
|
4
4
|
constructor(env: Env);
|
|
5
|
-
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
5
|
+
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
|
|
6
6
|
}
|
|
@@ -5,5 +5,5 @@ export declare class HaedalPmm implements Dex {
|
|
|
5
5
|
private connection;
|
|
6
6
|
private pythClient;
|
|
7
7
|
constructor(env: Env, suiClient: SuiClient);
|
|
8
|
-
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
8
|
+
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
|
|
9
9
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
2
2
|
import { AggregatorClient, Path } from "..";
|
|
3
3
|
export declare const CLOCK_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000006";
|
|
4
|
+
export declare const AGGREGATOR_V2 = "aggregator_v2";
|
|
5
|
+
export declare const AGGREGATOR_V2_EXTEND = "aggregator_v2_extend";
|
|
6
|
+
export declare function getAggregatorV2PublishedAt(aggregatorV2PublishedAt: string, packages?: Map<string, string> | Record<string, string>): string;
|
|
7
|
+
export declare function getAggregatorV2ExtendPublishedAt(aggregatorV2ExtendPublishedAt: string, packages?: Map<string, string> | Record<string, string>): string;
|
|
4
8
|
export interface Dex {
|
|
5
|
-
swap(client: AggregatorClient, ptb: Transaction, path: Path, inputCoin: TransactionObjectArgument, deepbookv3DeepFee?: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
9
|
+
swap(client: AggregatorClient, ptb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>, deepbookv3DeepFee?: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
6
10
|
}
|
|
@@ -2,5 +2,5 @@ import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions
|
|
|
2
2
|
import { AggregatorClient, Dex, Env, Path } from "..";
|
|
3
3
|
export declare class KriyaV2 implements Dex {
|
|
4
4
|
constructor(env: Env);
|
|
5
|
-
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
5
|
+
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
|
|
6
6
|
}
|
|
@@ -3,5 +3,5 @@ import { AggregatorClient, Dex, Env, Path } from "..";
|
|
|
3
3
|
export declare class KriyaV3 implements Dex {
|
|
4
4
|
private version;
|
|
5
5
|
constructor(env: Env);
|
|
6
|
-
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
6
|
+
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
|
|
7
7
|
}
|
|
@@ -4,5 +4,5 @@ export declare class Scallop implements Dex {
|
|
|
4
4
|
private version;
|
|
5
5
|
private market;
|
|
6
6
|
constructor(env: Env);
|
|
7
|
-
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
7
|
+
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
|
|
8
8
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
2
2
|
import { AggregatorClient, Dex, Env, Path } from "..";
|
|
3
3
|
export declare class Suilend implements Dex {
|
|
4
|
-
private liquid_staking_pool;
|
|
5
4
|
private sui_system_state;
|
|
6
5
|
constructor(env: Env);
|
|
7
|
-
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
6
|
+
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
|
|
8
7
|
}
|
|
@@ -3,5 +3,5 @@ import { AggregatorClient, Dex, Env, Path } from "..";
|
|
|
3
3
|
export declare class Turbos implements Dex {
|
|
4
4
|
private versioned;
|
|
5
5
|
constructor(env: Env);
|
|
6
|
-
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
6
|
+
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
|
|
7
7
|
}
|
|
@@ -4,5 +4,5 @@ export declare class Volo implements Dex {
|
|
|
4
4
|
private nativePool;
|
|
5
5
|
private metadata;
|
|
6
6
|
constructor(env: Env);
|
|
7
|
-
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
7
|
+
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
|
|
8
8
|
}
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -67,8 +67,10 @@ export type RouterError = {
|
|
|
67
67
|
export type RouterData = {
|
|
68
68
|
amountIn: BN
|
|
69
69
|
amountOut: BN
|
|
70
|
+
byAmountIn: boolean
|
|
70
71
|
routes: Router[]
|
|
71
72
|
insufficientLiquidity: boolean
|
|
73
|
+
packages?: Map<string, string>
|
|
72
74
|
totalDeepFee?: number
|
|
73
75
|
error?: RouterError
|
|
74
76
|
}
|
|
@@ -99,6 +101,7 @@ export async function getRouterResult(
|
|
|
99
101
|
amountIn: ZERO,
|
|
100
102
|
amountOut: ZERO,
|
|
101
103
|
routes: [],
|
|
104
|
+
byAmountIn: params.byAmountIn,
|
|
102
105
|
insufficientLiquidity: false,
|
|
103
106
|
error: {
|
|
104
107
|
code: AggregatorServerErrorCode.NumberTooLarge,
|
|
@@ -116,6 +119,7 @@ export async function getRouterResult(
|
|
|
116
119
|
amountIn: ZERO,
|
|
117
120
|
amountOut: ZERO,
|
|
118
121
|
routes: [],
|
|
122
|
+
byAmountIn: params.byAmountIn,
|
|
119
123
|
insufficientLiquidity,
|
|
120
124
|
error: {
|
|
121
125
|
code: AggregatorServerErrorCode.HoneyPot,
|
|
@@ -126,16 +130,16 @@ export async function getRouterResult(
|
|
|
126
130
|
}
|
|
127
131
|
}
|
|
128
132
|
if (data.data != null) {
|
|
129
|
-
const res = parseRouterResponse(data.data)
|
|
133
|
+
const res = parseRouterResponse(data.data, params.byAmountIn)
|
|
130
134
|
return res
|
|
131
135
|
}
|
|
132
|
-
|
|
133
136
|
|
|
134
137
|
return {
|
|
135
138
|
amountIn: ZERO,
|
|
136
139
|
amountOut: ZERO,
|
|
137
140
|
routes: [],
|
|
138
141
|
insufficientLiquidity,
|
|
142
|
+
byAmountIn: params.byAmountIn,
|
|
139
143
|
error: {
|
|
140
144
|
code: AggregatorServerErrorCode.InsufficientLiquidity,
|
|
141
145
|
msg: getAggregatorServerErrorMessage(
|
|
@@ -186,7 +190,7 @@ async function getRouter(endpoint: string, params: FindRouterParams) {
|
|
|
186
190
|
}
|
|
187
191
|
|
|
188
192
|
// set newest sdk version
|
|
189
|
-
url += "&v=
|
|
193
|
+
url += "&v=1000318"
|
|
190
194
|
|
|
191
195
|
const response = await fetch(url)
|
|
192
196
|
return response
|