@cetusprotocol/aggregator-sdk 0.0.0-experimental-20241010160019 → 0.0.0-experimental-20241011205228
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 +3 -25
- package/dist/index.d.ts +3 -25
- package/dist/index.js +17 -104
- package/dist/index.mjs +17 -101
- package/dist/src/api.d.ts +0 -15
- package/dist/src/client.d.ts +2 -7
- package/dist/src/transaction/index.d.ts +1 -1
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/tests/test_data.test.d.ts +0 -1
- package/package.json +1 -1
- package/src/api.ts +7 -32
- package/src/client.ts +10 -44
- package/src/transaction/afsui.ts +1 -0
- package/src/transaction/aftermath.ts +2 -0
- package/src/transaction/deepbook_v2.ts +1 -0
- package/src/transaction/index.ts +1 -2
- package/src/utils/index.ts +0 -1
- package/tests/router.test.ts +26 -26
- package/tests/test_data.test.ts +0 -1
- package/dist/src/transaction/deepbook_v3.d.ts +0 -13
- package/dist/src/utils/api.d.ts +0 -1
- package/src/transaction/deepbook_v3.ts +0 -68
- package/src/utils/api.ts +0 -6
- package/test.json +0 -5
package/dist/index.d.mts
CHANGED
|
@@ -72,7 +72,6 @@ declare const HAEDAL = "HAEDAL";
|
|
|
72
72
|
declare const VOLO = "VOLO";
|
|
73
73
|
declare const AFSUI = "AFSUI";
|
|
74
74
|
declare const BLUEMOVE = "BLUEMOVE";
|
|
75
|
-
declare const DEEPBOOKV3 = "DEEPBOOKV3";
|
|
76
75
|
type BuildRouterSwapParams = {
|
|
77
76
|
routers: Router[];
|
|
78
77
|
byAmountIn: boolean;
|
|
@@ -80,7 +79,6 @@ type BuildRouterSwapParams = {
|
|
|
80
79
|
slippage: number;
|
|
81
80
|
txb: Transaction;
|
|
82
81
|
partner?: string;
|
|
83
|
-
deepbookv3DeepFee?: TransactionObjectArgument;
|
|
84
82
|
};
|
|
85
83
|
type BuildFastRouterSwapParams = {
|
|
86
84
|
routers: Router[];
|
|
@@ -90,7 +88,6 @@ type BuildFastRouterSwapParams = {
|
|
|
90
88
|
partner?: string;
|
|
91
89
|
isMergeTragetCoin?: boolean;
|
|
92
90
|
refreshAllCoins?: boolean;
|
|
93
|
-
deepbookv3DeepFee?: TransactionObjectArgument;
|
|
94
91
|
};
|
|
95
92
|
interface SwapInPoolsParams {
|
|
96
93
|
from: string;
|
|
@@ -112,26 +109,24 @@ declare class AggregatorClient {
|
|
|
112
109
|
constructor(endpoint: string, signer: string, client: SuiClient, env: Env);
|
|
113
110
|
getAllCoins(): Promise<CoinAsset[]>;
|
|
114
111
|
findRouters(params: FindRouterParams): Promise<RouterData | null>;
|
|
115
|
-
expectInputSwap(txb: Transaction, inputCoin: TransactionObjectArgument, routers: Router[], amountOutLimit: BN, partner?: string
|
|
112
|
+
expectInputSwap(txb: Transaction, inputCoin: TransactionObjectArgument, routers: Router[], amountOutLimit: BN, partner?: string): Promise<TransactionObjectArgument>;
|
|
116
113
|
expectOutputSwap(txb: Transaction, inputCoin: TransactionObjectArgument, routers: Router[], partner?: string): Promise<TransactionObjectArgument>;
|
|
117
114
|
swapInPools(params: SwapInPoolsParams): Promise<SwapInPoolsResult | null>;
|
|
118
115
|
routerSwap(params: BuildRouterSwapParams): Promise<TransactionObjectArgument>;
|
|
119
116
|
fastRouterSwap(params: BuildFastRouterSwapParams): Promise<void>;
|
|
120
117
|
publishedAt(): string;
|
|
121
|
-
deepbookv3DeepFeeType(): string;
|
|
122
118
|
transferOrDestoryCoin(txb: Transaction, coin: TransactionObjectArgument, coinType: string): void;
|
|
123
119
|
checkCoinThresholdAndMergeCoin(txb: Transaction, coins: TransactionObjectArgument[], coinType: string, amountLimit: BN): TransactionObjectArgument;
|
|
124
120
|
newDex(provider: string, partner?: string): Dex;
|
|
125
121
|
signAndExecuteTransaction(txb: Transaction, signer: Signer): Promise<_mysten_sui_client.SuiTransactionBlockResponse>;
|
|
126
122
|
devInspectTransactionBlock(txb: Transaction): Promise<_mysten_sui_client.DevInspectResults>;
|
|
127
123
|
sendTransaction(txb: Transaction, signer: Signer): Promise<_mysten_sui_client.SuiTransactionBlockResponse>;
|
|
128
|
-
getDeepbookV3Config(): Promise<DeepbookV3Config | null>;
|
|
129
124
|
}
|
|
130
125
|
declare function parseRouterResponse(data: any): RouterData;
|
|
131
126
|
|
|
132
127
|
declare const CLOCK_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000006";
|
|
133
128
|
interface Dex {
|
|
134
|
-
swap(client: AggregatorClient, ptb: Transaction, path: Path, inputCoin: TransactionObjectArgument
|
|
129
|
+
swap(client: AggregatorClient, ptb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
135
130
|
}
|
|
136
131
|
|
|
137
132
|
declare function isSortedSymbols(symbolX: string, symbolY: string): boolean;
|
|
@@ -153,8 +148,6 @@ declare function createTarget(packageName: string, moduleName: string, functionN
|
|
|
153
148
|
declare const dealWithFastRouterSwapParamsForMsafe: (data: any) => any;
|
|
154
149
|
declare const restituteMsafeFastRouterSwapParams: (data: any) => any;
|
|
155
150
|
|
|
156
|
-
declare function processEndpoint(endpoint: string): string;
|
|
157
|
-
|
|
158
151
|
declare const ZERO: BN;
|
|
159
152
|
declare const ONE: BN;
|
|
160
153
|
declare const TWO: BN;
|
|
@@ -186,7 +179,6 @@ type ExtendedDetails = {
|
|
|
186
179
|
aftermathLpSupplyType?: string;
|
|
187
180
|
turbosFeeType?: string;
|
|
188
181
|
afterSqrtPrice?: string;
|
|
189
|
-
deepbookv3DeepFee?: number;
|
|
190
182
|
};
|
|
191
183
|
type Path = {
|
|
192
184
|
id: string;
|
|
@@ -223,24 +215,10 @@ type AggregatorResponse = {
|
|
|
223
215
|
data: RouterData;
|
|
224
216
|
};
|
|
225
217
|
declare function getRouterResult(endpoint: string, params: FindRouterParams): Promise<RouterData | null>;
|
|
226
|
-
type DeepbookV3Config = {
|
|
227
|
-
id: string;
|
|
228
|
-
is_alternative_payment: boolean;
|
|
229
|
-
deep_fee_vault: number;
|
|
230
|
-
whitelist: number;
|
|
231
|
-
whitelist_pools: string[];
|
|
232
|
-
last_updated_time: number;
|
|
233
|
-
};
|
|
234
|
-
type DeepbookV3ConfigResponse = {
|
|
235
|
-
code: number;
|
|
236
|
-
msg: string;
|
|
237
|
-
data: DeepbookV3Config;
|
|
238
|
-
};
|
|
239
|
-
declare function getDeepbookV3Config(endpoint: string): Promise<DeepbookV3ConfigResponse | null>;
|
|
240
218
|
|
|
241
219
|
declare enum Env {
|
|
242
220
|
Mainnet = 0,
|
|
243
221
|
Testnet = 1
|
|
244
222
|
}
|
|
245
223
|
|
|
246
|
-
export { AFSUI, AFTERMATH, AggregatorClient, type AggregatorResponse, BLUEMOVE, type BuildFastRouterSwapParams, type BuildRouterSwapParams, CETUS, CLOCK_ADDRESS, DEEPBOOKV2,
|
|
224
|
+
export { AFSUI, AFTERMATH, AggregatorClient, type AggregatorResponse, BLUEMOVE, type BuildFastRouterSwapParams, type BuildRouterSwapParams, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, KRIYA, KRIYAV3, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getRouterResult, isSortedSymbols, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, restituteMsafeFastRouterSwapParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -72,7 +72,6 @@ declare const HAEDAL = "HAEDAL";
|
|
|
72
72
|
declare const VOLO = "VOLO";
|
|
73
73
|
declare const AFSUI = "AFSUI";
|
|
74
74
|
declare const BLUEMOVE = "BLUEMOVE";
|
|
75
|
-
declare const DEEPBOOKV3 = "DEEPBOOKV3";
|
|
76
75
|
type BuildRouterSwapParams = {
|
|
77
76
|
routers: Router[];
|
|
78
77
|
byAmountIn: boolean;
|
|
@@ -80,7 +79,6 @@ type BuildRouterSwapParams = {
|
|
|
80
79
|
slippage: number;
|
|
81
80
|
txb: Transaction;
|
|
82
81
|
partner?: string;
|
|
83
|
-
deepbookv3DeepFee?: TransactionObjectArgument;
|
|
84
82
|
};
|
|
85
83
|
type BuildFastRouterSwapParams = {
|
|
86
84
|
routers: Router[];
|
|
@@ -90,7 +88,6 @@ type BuildFastRouterSwapParams = {
|
|
|
90
88
|
partner?: string;
|
|
91
89
|
isMergeTragetCoin?: boolean;
|
|
92
90
|
refreshAllCoins?: boolean;
|
|
93
|
-
deepbookv3DeepFee?: TransactionObjectArgument;
|
|
94
91
|
};
|
|
95
92
|
interface SwapInPoolsParams {
|
|
96
93
|
from: string;
|
|
@@ -112,26 +109,24 @@ declare class AggregatorClient {
|
|
|
112
109
|
constructor(endpoint: string, signer: string, client: SuiClient, env: Env);
|
|
113
110
|
getAllCoins(): Promise<CoinAsset[]>;
|
|
114
111
|
findRouters(params: FindRouterParams): Promise<RouterData | null>;
|
|
115
|
-
expectInputSwap(txb: Transaction, inputCoin: TransactionObjectArgument, routers: Router[], amountOutLimit: BN, partner?: string
|
|
112
|
+
expectInputSwap(txb: Transaction, inputCoin: TransactionObjectArgument, routers: Router[], amountOutLimit: BN, partner?: string): Promise<TransactionObjectArgument>;
|
|
116
113
|
expectOutputSwap(txb: Transaction, inputCoin: TransactionObjectArgument, routers: Router[], partner?: string): Promise<TransactionObjectArgument>;
|
|
117
114
|
swapInPools(params: SwapInPoolsParams): Promise<SwapInPoolsResult | null>;
|
|
118
115
|
routerSwap(params: BuildRouterSwapParams): Promise<TransactionObjectArgument>;
|
|
119
116
|
fastRouterSwap(params: BuildFastRouterSwapParams): Promise<void>;
|
|
120
117
|
publishedAt(): string;
|
|
121
|
-
deepbookv3DeepFeeType(): string;
|
|
122
118
|
transferOrDestoryCoin(txb: Transaction, coin: TransactionObjectArgument, coinType: string): void;
|
|
123
119
|
checkCoinThresholdAndMergeCoin(txb: Transaction, coins: TransactionObjectArgument[], coinType: string, amountLimit: BN): TransactionObjectArgument;
|
|
124
120
|
newDex(provider: string, partner?: string): Dex;
|
|
125
121
|
signAndExecuteTransaction(txb: Transaction, signer: Signer): Promise<_mysten_sui_client.SuiTransactionBlockResponse>;
|
|
126
122
|
devInspectTransactionBlock(txb: Transaction): Promise<_mysten_sui_client.DevInspectResults>;
|
|
127
123
|
sendTransaction(txb: Transaction, signer: Signer): Promise<_mysten_sui_client.SuiTransactionBlockResponse>;
|
|
128
|
-
getDeepbookV3Config(): Promise<DeepbookV3Config | null>;
|
|
129
124
|
}
|
|
130
125
|
declare function parseRouterResponse(data: any): RouterData;
|
|
131
126
|
|
|
132
127
|
declare const CLOCK_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000006";
|
|
133
128
|
interface Dex {
|
|
134
|
-
swap(client: AggregatorClient, ptb: Transaction, path: Path, inputCoin: TransactionObjectArgument
|
|
129
|
+
swap(client: AggregatorClient, ptb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
135
130
|
}
|
|
136
131
|
|
|
137
132
|
declare function isSortedSymbols(symbolX: string, symbolY: string): boolean;
|
|
@@ -153,8 +148,6 @@ declare function createTarget(packageName: string, moduleName: string, functionN
|
|
|
153
148
|
declare const dealWithFastRouterSwapParamsForMsafe: (data: any) => any;
|
|
154
149
|
declare const restituteMsafeFastRouterSwapParams: (data: any) => any;
|
|
155
150
|
|
|
156
|
-
declare function processEndpoint(endpoint: string): string;
|
|
157
|
-
|
|
158
151
|
declare const ZERO: BN;
|
|
159
152
|
declare const ONE: BN;
|
|
160
153
|
declare const TWO: BN;
|
|
@@ -186,7 +179,6 @@ type ExtendedDetails = {
|
|
|
186
179
|
aftermathLpSupplyType?: string;
|
|
187
180
|
turbosFeeType?: string;
|
|
188
181
|
afterSqrtPrice?: string;
|
|
189
|
-
deepbookv3DeepFee?: number;
|
|
190
182
|
};
|
|
191
183
|
type Path = {
|
|
192
184
|
id: string;
|
|
@@ -223,24 +215,10 @@ type AggregatorResponse = {
|
|
|
223
215
|
data: RouterData;
|
|
224
216
|
};
|
|
225
217
|
declare function getRouterResult(endpoint: string, params: FindRouterParams): Promise<RouterData | null>;
|
|
226
|
-
type DeepbookV3Config = {
|
|
227
|
-
id: string;
|
|
228
|
-
is_alternative_payment: boolean;
|
|
229
|
-
deep_fee_vault: number;
|
|
230
|
-
whitelist: number;
|
|
231
|
-
whitelist_pools: string[];
|
|
232
|
-
last_updated_time: number;
|
|
233
|
-
};
|
|
234
|
-
type DeepbookV3ConfigResponse = {
|
|
235
|
-
code: number;
|
|
236
|
-
msg: string;
|
|
237
|
-
data: DeepbookV3Config;
|
|
238
|
-
};
|
|
239
|
-
declare function getDeepbookV3Config(endpoint: string): Promise<DeepbookV3ConfigResponse | null>;
|
|
240
218
|
|
|
241
219
|
declare enum Env {
|
|
242
220
|
Mainnet = 0,
|
|
243
221
|
Testnet = 1
|
|
244
222
|
}
|
|
245
223
|
|
|
246
|
-
export { AFSUI, AFTERMATH, AggregatorClient, type AggregatorResponse, BLUEMOVE, type BuildFastRouterSwapParams, type BuildRouterSwapParams, CETUS, CLOCK_ADDRESS, DEEPBOOKV2,
|
|
224
|
+
export { AFSUI, AFTERMATH, AggregatorClient, type AggregatorResponse, BLUEMOVE, type BuildFastRouterSwapParams, type BuildRouterSwapParams, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, KRIYA, KRIYAV3, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getRouterResult, isSortedSymbols, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, restituteMsafeFastRouterSwapParams };
|
package/dist/index.js
CHANGED
|
@@ -5992,45 +5992,6 @@ var Bluemove = class {
|
|
|
5992
5992
|
}
|
|
5993
5993
|
};
|
|
5994
5994
|
|
|
5995
|
-
// src/transaction/deepbook_v3.ts
|
|
5996
|
-
var DeepbookV3 = class {
|
|
5997
|
-
constructor(env) {
|
|
5998
|
-
this.deepbookV3Config = env === 0 /* Mainnet */ ? "0x0" : "0xe19b5d072346cae83a037d4e3c8492068a74410a74e5830b3a68012db38296aa";
|
|
5999
|
-
this.deepCoinType = env === 0 /* Mainnet */ ? "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP" : "0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP";
|
|
6000
|
-
}
|
|
6001
|
-
swap(client, txb, path, inputCoin, deepbookv3DeepFee) {
|
|
6002
|
-
return __async(this, null, function* () {
|
|
6003
|
-
var _a, _b, _c;
|
|
6004
|
-
const { direction, from, target } = path;
|
|
6005
|
-
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
6006
|
-
let deepFee;
|
|
6007
|
-
if (deepbookv3DeepFee) {
|
|
6008
|
-
if (((_a = path.extendedDetails) == null ? void 0 : _a.deepbookv3DeepFee) && ((_b = path.extendedDetails) == null ? void 0 : _b.deepbookv3DeepFee) > 0) {
|
|
6009
|
-
const splitAmounts = [(_c = path.extendedDetails) == null ? void 0 : _c.deepbookv3DeepFee];
|
|
6010
|
-
deepFee = txb.splitCoins(deepbookv3DeepFee, splitAmounts)[0];
|
|
6011
|
-
} else {
|
|
6012
|
-
deepFee = mintZeroCoin(txb, this.deepCoinType);
|
|
6013
|
-
}
|
|
6014
|
-
} else {
|
|
6015
|
-
deepFee = mintZeroCoin(txb, this.deepCoinType);
|
|
6016
|
-
}
|
|
6017
|
-
const args = [
|
|
6018
|
-
txb.object(this.deepbookV3Config),
|
|
6019
|
-
txb.object(path.id),
|
|
6020
|
-
inputCoin,
|
|
6021
|
-
deepFee,
|
|
6022
|
-
txb.object(CLOCK_ADDRESS)
|
|
6023
|
-
];
|
|
6024
|
-
const res = txb.moveCall({
|
|
6025
|
-
target: `${client.publishedAt()}::deepbookv3::${func}`,
|
|
6026
|
-
typeArguments: [coinAType, coinBType],
|
|
6027
|
-
arguments: args
|
|
6028
|
-
});
|
|
6029
|
-
return res;
|
|
6030
|
-
});
|
|
6031
|
-
}
|
|
6032
|
-
};
|
|
6033
|
-
|
|
6034
5995
|
// src/client.ts
|
|
6035
5996
|
var CETUS = "CETUS";
|
|
6036
5997
|
var DEEPBOOKV2 = "DEEPBOOK";
|
|
@@ -6044,10 +6005,9 @@ var HAEDAL = "HAEDAL";
|
|
|
6044
6005
|
var VOLO = "VOLO";
|
|
6045
6006
|
var AFSUI = "AFSUI";
|
|
6046
6007
|
var BLUEMOVE = "BLUEMOVE";
|
|
6047
|
-
var
|
|
6048
|
-
var AggregatorClient7 = class {
|
|
6008
|
+
var AggregatorClient6 = class {
|
|
6049
6009
|
constructor(endpoint, signer, client, env) {
|
|
6050
|
-
this.endpoint =
|
|
6010
|
+
this.endpoint = endpoint;
|
|
6051
6011
|
this.client = client;
|
|
6052
6012
|
this.signer = signer;
|
|
6053
6013
|
this.env = env;
|
|
@@ -6084,7 +6044,7 @@ var AggregatorClient7 = class {
|
|
|
6084
6044
|
return getRouterResult(this.endpoint, params);
|
|
6085
6045
|
});
|
|
6086
6046
|
}
|
|
6087
|
-
expectInputSwap(txb, inputCoin, routers, amountOutLimit, partner
|
|
6047
|
+
expectInputSwap(txb, inputCoin, routers, amountOutLimit, partner) {
|
|
6088
6048
|
return __async(this, null, function* () {
|
|
6089
6049
|
if (routers.length === 0) {
|
|
6090
6050
|
throw new Error("No router found");
|
|
@@ -6101,14 +6061,11 @@ var AggregatorClient7 = class {
|
|
|
6101
6061
|
let nextCoin = inputCoins[i];
|
|
6102
6062
|
for (const path of routers[i].path) {
|
|
6103
6063
|
const dex = this.newDex(path.provider, partner);
|
|
6104
|
-
nextCoin = yield dex.swap(this, txb, path, nextCoin
|
|
6064
|
+
nextCoin = yield dex.swap(this, txb, path, nextCoin);
|
|
6105
6065
|
}
|
|
6106
6066
|
outputCoins.push(nextCoin);
|
|
6107
6067
|
}
|
|
6108
6068
|
this.transferOrDestoryCoin(txb, inputCoin, inputCoinType);
|
|
6109
|
-
if (deepbookv3DeepFee) {
|
|
6110
|
-
this.transferOrDestoryCoin(txb, deepbookv3DeepFee, this.deepbookv3DeepFeeType());
|
|
6111
|
-
}
|
|
6112
6069
|
const mergedTargetCointhis = this.checkCoinThresholdAndMergeCoin(
|
|
6113
6070
|
txb,
|
|
6114
6071
|
outputCoins,
|
|
@@ -6180,7 +6137,7 @@ var AggregatorClient7 = class {
|
|
|
6180
6137
|
}
|
|
6181
6138
|
routerSwap(params) {
|
|
6182
6139
|
return __async(this, null, function* () {
|
|
6183
|
-
const { routers, inputCoin, slippage, byAmountIn, txb, partner
|
|
6140
|
+
const { routers, inputCoin, slippage, byAmountIn, txb, partner } = params;
|
|
6184
6141
|
const amountIn = routers.reduce(
|
|
6185
6142
|
(acc, router) => acc.add(router.amountIn),
|
|
6186
6143
|
new import_bn5.default(0)
|
|
@@ -6200,8 +6157,7 @@ var AggregatorClient7 = class {
|
|
|
6200
6157
|
inputCoin,
|
|
6201
6158
|
routers,
|
|
6202
6159
|
new import_bn5.default(amountLimit),
|
|
6203
|
-
partner
|
|
6204
|
-
deepbookv3DeepFee
|
|
6160
|
+
partner
|
|
6205
6161
|
);
|
|
6206
6162
|
return targetCoin2;
|
|
6207
6163
|
}
|
|
@@ -6229,8 +6185,7 @@ var AggregatorClient7 = class {
|
|
|
6229
6185
|
txb,
|
|
6230
6186
|
partner,
|
|
6231
6187
|
isMergeTragetCoin,
|
|
6232
|
-
refreshAllCoins
|
|
6233
|
-
deepbookv3DeepFee
|
|
6188
|
+
refreshAllCoins
|
|
6234
6189
|
} = params;
|
|
6235
6190
|
if (refreshAllCoins || this.allCoins.length === 0) {
|
|
6236
6191
|
this.allCoins = yield this.getAllCoins();
|
|
@@ -6263,8 +6218,7 @@ var AggregatorClient7 = class {
|
|
|
6263
6218
|
slippage,
|
|
6264
6219
|
byAmountIn,
|
|
6265
6220
|
txb,
|
|
6266
|
-
partner
|
|
6267
|
-
deepbookv3DeepFee
|
|
6221
|
+
partner
|
|
6268
6222
|
});
|
|
6269
6223
|
if (isMergeTragetCoin) {
|
|
6270
6224
|
const targetCoinRes = buildInputCoin(
|
|
@@ -6288,16 +6242,9 @@ var AggregatorClient7 = class {
|
|
|
6288
6242
|
}
|
|
6289
6243
|
publishedAt() {
|
|
6290
6244
|
if (this.env === 0 /* Mainnet */) {
|
|
6291
|
-
return "
|
|
6292
|
-
} else {
|
|
6293
|
-
return "0xf92cdec6c2d73a12d8afa8dd41199b3e95b621272bbc655996539cd30de6a462";
|
|
6294
|
-
}
|
|
6295
|
-
}
|
|
6296
|
-
deepbookv3DeepFeeType() {
|
|
6297
|
-
if (this.env === 0 /* Mainnet */) {
|
|
6298
|
-
return "0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP";
|
|
6245
|
+
return "0x7eb2f30d541c06fa7bcf26444845df56361647df0e778b82e5707fb26754c398";
|
|
6299
6246
|
} else {
|
|
6300
|
-
return "
|
|
6247
|
+
return "0x6cbaa3e9fbe902d90191b12f315932bc58079cba422bafbd4b4369f80e61f595";
|
|
6301
6248
|
}
|
|
6302
6249
|
}
|
|
6303
6250
|
transferOrDestoryCoin(txb, coin, coinType) {
|
|
@@ -6331,8 +6278,6 @@ var AggregatorClient7 = class {
|
|
|
6331
6278
|
return new Cetus(this.env, partner);
|
|
6332
6279
|
case DEEPBOOKV2:
|
|
6333
6280
|
return new DeepbookV2(this.env);
|
|
6334
|
-
case DEEPBOOKV3:
|
|
6335
|
-
return new DeepbookV3(this.env);
|
|
6336
6281
|
case KRIYA:
|
|
6337
6282
|
return new KriyaV2(this.env);
|
|
6338
6283
|
case KRIYAV3:
|
|
@@ -6390,15 +6335,6 @@ var AggregatorClient7 = class {
|
|
|
6390
6335
|
return res;
|
|
6391
6336
|
});
|
|
6392
6337
|
}
|
|
6393
|
-
getDeepbookV3Config() {
|
|
6394
|
-
return __async(this, null, function* () {
|
|
6395
|
-
const res = yield getDeepbookV3Config(this.endpoint);
|
|
6396
|
-
if (res) {
|
|
6397
|
-
return res.data;
|
|
6398
|
-
}
|
|
6399
|
-
return null;
|
|
6400
|
-
});
|
|
6401
|
-
}
|
|
6402
6338
|
};
|
|
6403
6339
|
function parseRouterResponse(data) {
|
|
6404
6340
|
return {
|
|
@@ -6408,18 +6344,17 @@ function parseRouterResponse(data) {
|
|
|
6408
6344
|
routes: data.routes.map((route) => {
|
|
6409
6345
|
return {
|
|
6410
6346
|
path: route.path.map((path) => {
|
|
6411
|
-
var _a, _b, _c
|
|
6347
|
+
var _a, _b, _c;
|
|
6412
6348
|
let version;
|
|
6413
6349
|
if (path.provider === AFTERMATH) {
|
|
6414
6350
|
version = path.extended_details.aftermath_pool_flatness === 0 ? "v2" : "v3";
|
|
6415
6351
|
}
|
|
6416
6352
|
let extendedDetails;
|
|
6417
|
-
if (path.provider === TURBOS || path.provider === AFTERMATH || path.provider === CETUS
|
|
6353
|
+
if (path.provider === TURBOS || path.provider === AFTERMATH || path.provider === CETUS) {
|
|
6418
6354
|
extendedDetails = {
|
|
6419
6355
|
aftermathLpSupplyType: (_a = path.extended_details) == null ? void 0 : _a.aftermath_lp_supply_type,
|
|
6420
6356
|
turbosFeeType: (_b = path.extended_details) == null ? void 0 : _b.turbos_fee_type,
|
|
6421
|
-
afterSqrtPrice: (_c = path.extended_details) == null ? void 0 : _c.after_sqrt_price
|
|
6422
|
-
deepbookv3DeepFee: (_d = path.extended_details) == null ? void 0 : _d.deepbookv3_deep_fee
|
|
6357
|
+
afterSqrtPrice: (_c = path.extended_details) == null ? void 0 : _c.after_sqrt_price
|
|
6423
6358
|
};
|
|
6424
6359
|
}
|
|
6425
6360
|
return {
|
|
@@ -6471,14 +6406,6 @@ var restituteMsafeFastRouterSwapParams = (data) => {
|
|
|
6471
6406
|
return result;
|
|
6472
6407
|
};
|
|
6473
6408
|
|
|
6474
|
-
// src/utils/api.ts
|
|
6475
|
-
function processEndpoint(endpoint) {
|
|
6476
|
-
if (endpoint.endsWith("/find_routes")) {
|
|
6477
|
-
return endpoint.replace("/find_routes", "");
|
|
6478
|
-
}
|
|
6479
|
-
return endpoint;
|
|
6480
|
-
}
|
|
6481
|
-
|
|
6482
6409
|
// src/api.ts
|
|
6483
6410
|
function getRouterResult(endpoint, params) {
|
|
6484
6411
|
return __async(this, null, function* () {
|
|
@@ -6541,7 +6468,7 @@ function getRouter(endpoint, params) {
|
|
|
6541
6468
|
} = params;
|
|
6542
6469
|
const fromCoin = completionCoin(from);
|
|
6543
6470
|
const targetCoin = completionCoin(target);
|
|
6544
|
-
let url = `${endpoint}
|
|
6471
|
+
let url = `${endpoint}?from=${fromCoin}&target=${targetCoin}&amount=${amount.toString()}&by_amount_in=${byAmountIn}`;
|
|
6545
6472
|
if (depth) {
|
|
6546
6473
|
url += `&depth=${depth}`;
|
|
6547
6474
|
}
|
|
@@ -6583,7 +6510,7 @@ function postRouterWithLiquidityChanges(endpoint, params) {
|
|
|
6583
6510
|
} = params;
|
|
6584
6511
|
const fromCoin = completionCoin(from);
|
|
6585
6512
|
const targetCoin = completionCoin(target);
|
|
6586
|
-
const url = `${endpoint}
|
|
6513
|
+
const url = `${endpoint}`;
|
|
6587
6514
|
const providersStr = providers == null ? void 0 : providers.join(",");
|
|
6588
6515
|
const requestData = {
|
|
6589
6516
|
from: fromCoin,
|
|
@@ -6602,6 +6529,7 @@ function postRouterWithLiquidityChanges(endpoint, params) {
|
|
|
6602
6529
|
delta_liquidity: change.deltaLiquidity
|
|
6603
6530
|
}))
|
|
6604
6531
|
};
|
|
6532
|
+
console.log("requestData", JSON.stringify(requestData, null, 2));
|
|
6605
6533
|
try {
|
|
6606
6534
|
const response = yield fetch(url, {
|
|
6607
6535
|
method: "POST",
|
|
@@ -6617,18 +6545,6 @@ function postRouterWithLiquidityChanges(endpoint, params) {
|
|
|
6617
6545
|
}
|
|
6618
6546
|
});
|
|
6619
6547
|
}
|
|
6620
|
-
function getDeepbookV3Config(endpoint) {
|
|
6621
|
-
return __async(this, null, function* () {
|
|
6622
|
-
const url = `${endpoint}/deepbookv3_config`;
|
|
6623
|
-
try {
|
|
6624
|
-
const response = yield fetch(url);
|
|
6625
|
-
return response.json();
|
|
6626
|
-
} catch (error) {
|
|
6627
|
-
console.error("Error:", error);
|
|
6628
|
-
return null;
|
|
6629
|
-
}
|
|
6630
|
-
});
|
|
6631
|
-
}
|
|
6632
6548
|
|
|
6633
6549
|
// src/index.ts
|
|
6634
6550
|
var Env = /* @__PURE__ */ ((Env2) => {
|
|
@@ -6650,12 +6566,11 @@ decimal.js/decimal.mjs:
|
|
|
6650
6566
|
|
|
6651
6567
|
exports.AFSUI = AFSUI;
|
|
6652
6568
|
exports.AFTERMATH = AFTERMATH;
|
|
6653
|
-
exports.AggregatorClient =
|
|
6569
|
+
exports.AggregatorClient = AggregatorClient6;
|
|
6654
6570
|
exports.BLUEMOVE = BLUEMOVE;
|
|
6655
6571
|
exports.CETUS = CETUS;
|
|
6656
6572
|
exports.CLOCK_ADDRESS = CLOCK_ADDRESS;
|
|
6657
6573
|
exports.DEEPBOOKV2 = DEEPBOOKV2;
|
|
6658
|
-
exports.DEEPBOOKV3 = DEEPBOOKV3;
|
|
6659
6574
|
exports.Env = Env;
|
|
6660
6575
|
exports.FLOWXV2 = FLOWXV2;
|
|
6661
6576
|
exports.FLOWXV3 = FLOWXV3;
|
|
@@ -6677,11 +6592,9 @@ exports.dealWithFastRouterSwapParamsForMsafe = dealWithFastRouterSwapParamsForMs
|
|
|
6677
6592
|
exports.extractAddressFromType = extractAddressFromType;
|
|
6678
6593
|
exports.extractStructTagFromType = extractStructTagFromType;
|
|
6679
6594
|
exports.fixSuiObjectId = fixSuiObjectId;
|
|
6680
|
-
exports.getDeepbookV3Config = getDeepbookV3Config;
|
|
6681
6595
|
exports.getRouterResult = getRouterResult;
|
|
6682
6596
|
exports.isSortedSymbols = isSortedSymbols;
|
|
6683
6597
|
exports.normalizeCoinType = normalizeCoinType;
|
|
6684
6598
|
exports.parseRouterResponse = parseRouterResponse;
|
|
6685
6599
|
exports.patchFixSuiObjectId = patchFixSuiObjectId;
|
|
6686
|
-
exports.processEndpoint = processEndpoint;
|
|
6687
6600
|
exports.restituteMsafeFastRouterSwapParams = restituteMsafeFastRouterSwapParams;
|