@cetusprotocol/aggregator-sdk 1.4.0 → 1.4.2
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/README.md +201 -61
- package/dist/index.d.mts +23 -9
- package/dist/index.d.ts +23 -9
- package/dist/index.js +263 -17
- package/dist/index.mjs +262 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,11 +79,11 @@ The new Aggregator Client V3 offers significant improvements over the previous v
|
|
|
79
79
|
|
|
80
80
|
- **Increased Reliability**: More robust transaction execution with better error handling
|
|
81
81
|
|
|
82
|
-
## Migration from
|
|
82
|
+
## Migration from V2 to V3 API
|
|
83
83
|
|
|
84
84
|
### Installation
|
|
85
85
|
|
|
86
|
-
Both
|
|
86
|
+
Both V2 and V3 APIs use the same package:
|
|
87
87
|
|
|
88
88
|
```bash
|
|
89
89
|
npm install @cetusprotocol/aggregator-sdk
|
|
@@ -91,61 +91,67 @@ npm install @cetusprotocol/aggregator-sdk
|
|
|
91
91
|
|
|
92
92
|
### Key Changes
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
**Important:** Both V2 and V3 use the same `AggregatorClient` class. The main differences are:
|
|
95
|
+
- **Return types**: V3 uses `RouterDataV3` (with flattened `paths`) instead of V2's `RouterData` (with nested `routes`)
|
|
96
|
+
- **Swap methods**: V3 introduces `fastRouterSwap()` for automatic coin handling
|
|
97
|
+
- **Transaction structure**: V3 optimizes gas through transaction merging
|
|
98
|
+
|
|
99
|
+
1. **Client Initialization (Same for both)**
|
|
95
100
|
|
|
96
101
|
```typescript
|
|
97
|
-
|
|
98
|
-
const client = new AggregatorClient({})
|
|
102
|
+
import { AggregatorClient } from "@cetusprotocol/aggregator-sdk"
|
|
99
103
|
|
|
100
|
-
|
|
101
|
-
|
|
104
|
+
const client = new AggregatorClient({
|
|
105
|
+
// Optional: Add custom configuration
|
|
106
|
+
})
|
|
102
107
|
```
|
|
103
108
|
|
|
104
|
-
2. **Router Finding**
|
|
109
|
+
2. **Router Finding (API unchanged, but return type differs)**
|
|
105
110
|
|
|
106
111
|
```typescript
|
|
107
|
-
|
|
112
|
+
import BN from "bn.js"
|
|
113
|
+
|
|
114
|
+
// Works with both V2 and V3
|
|
108
115
|
const routers = await client.findRouters({
|
|
109
116
|
from: "0x2::sui::SUI",
|
|
110
|
-
target:
|
|
111
|
-
"0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS",
|
|
117
|
+
target: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS",
|
|
112
118
|
amount: new BN(1000000),
|
|
113
119
|
byAmountIn: true,
|
|
114
120
|
})
|
|
121
|
+
|
|
122
|
+
// V2 returns: RouterData with routes[]
|
|
123
|
+
// V3 returns: RouterDataV3 with paths[]
|
|
115
124
|
```
|
|
116
125
|
|
|
117
126
|
3. **Transaction Building**
|
|
118
127
|
|
|
119
128
|
```typescript
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
txb,
|
|
124
|
-
inputCoin,
|
|
125
|
-
slippage: 0.01,
|
|
126
|
-
})
|
|
129
|
+
import { Transaction } from "@mysten/sui/transactions"
|
|
130
|
+
|
|
131
|
+
const txb = new Transaction()
|
|
127
132
|
|
|
128
|
-
// V3 Method (Recommended)
|
|
133
|
+
// V3 Method (Recommended) - Automatic coin handling
|
|
129
134
|
await client.fastRouterSwap({
|
|
130
|
-
routers,
|
|
135
|
+
router: routers,
|
|
131
136
|
txb,
|
|
132
137
|
slippage: 0.01,
|
|
133
138
|
})
|
|
134
139
|
|
|
135
|
-
// V3 Alternative
|
|
140
|
+
// V3 Alternative - Manual coin handling for PTB building
|
|
136
141
|
const targetCoin = await client.routerSwap({
|
|
137
|
-
routers,
|
|
142
|
+
router: routers,
|
|
138
143
|
txb,
|
|
139
|
-
inputCoin,
|
|
144
|
+
inputCoin, // TransactionObjectArgument
|
|
140
145
|
slippage: 0.01,
|
|
141
146
|
})
|
|
142
147
|
```
|
|
143
148
|
|
|
144
|
-
4. **Benefits of Migration**
|
|
149
|
+
4. **Benefits of V3 Migration**
|
|
145
150
|
- Reduced gas costs through transaction merging
|
|
146
|
-
- Better transaction traceability
|
|
151
|
+
- Better transaction traceability on-chain
|
|
147
152
|
- Improved error handling and reliability
|
|
148
153
|
- Access to latest DEX integrations
|
|
154
|
+
- Automatic coin management with `fastRouterSwap()`
|
|
149
155
|
|
|
150
156
|
## Install
|
|
151
157
|
|
|
@@ -157,74 +163,208 @@ npm install @cetusprotocol/aggregator-sdk
|
|
|
157
163
|
|
|
158
164
|
## Usage
|
|
159
165
|
|
|
160
|
-
###
|
|
166
|
+
### Complete Example with All Imports
|
|
161
167
|
|
|
162
168
|
```typescript
|
|
163
|
-
|
|
169
|
+
import { AggregatorClient } from "@cetusprotocol/aggregator-sdk"
|
|
170
|
+
import { Transaction } from "@mysten/sui/transactions"
|
|
171
|
+
import BN from "bn.js"
|
|
172
|
+
import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519"
|
|
173
|
+
|
|
174
|
+
// Initialize your keypair (example using Ed25519)
|
|
175
|
+
const keypair = Ed25519Keypair.deriveKeypair("your-mnemonic-phrase")
|
|
164
176
|
```
|
|
165
177
|
|
|
166
|
-
###
|
|
178
|
+
### 1. Initialize Client
|
|
167
179
|
|
|
168
180
|
```typescript
|
|
169
|
-
|
|
181
|
+
import { Env } from "@cetusprotocol/aggregator-sdk"
|
|
182
|
+
import { getFullnodeUrl, SuiClient } from "@mysten/sui/client"
|
|
183
|
+
|
|
184
|
+
const client = new AggregatorClient({
|
|
185
|
+
// Optional configuration parameters:
|
|
186
|
+
|
|
187
|
+
// Network environment (default: Mainnet)
|
|
188
|
+
env: Env.Mainnet, // or Env.Testnet
|
|
189
|
+
|
|
190
|
+
// Custom API endpoint for aggregator service
|
|
191
|
+
// endpoint: "https://api-sui.cetus.zone",
|
|
192
|
+
|
|
193
|
+
// Custom Sui client (default: mainnet RPC)
|
|
194
|
+
// client: new SuiClient({ url: getFullnodeUrl("mainnet") }),
|
|
195
|
+
|
|
196
|
+
// Partner ID for revenue sharing
|
|
197
|
+
// partner: "your-partner-id",
|
|
198
|
+
|
|
199
|
+
// CETUS DLMM specific partner ID
|
|
200
|
+
// cetusDlmmPartner: "your-dlmm-partner-id",
|
|
201
|
+
|
|
202
|
+
// Overlay fee rate (0 to 0.01 for 0-1%)
|
|
203
|
+
// overlayFeeRate: 0.001, // 0.1%
|
|
204
|
+
|
|
205
|
+
// Overlay fee receiver address
|
|
206
|
+
// overlayFeeReceiver: "0x...",
|
|
207
|
+
|
|
208
|
+
// Custom Pyth oracle URLs
|
|
209
|
+
// pythUrls: ["https://hermes.pyth.network"],
|
|
210
|
+
|
|
211
|
+
// API key for rate limiting
|
|
212
|
+
// apiKey: "your-api-key",
|
|
213
|
+
})
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### 2. Find Best Router
|
|
217
|
+
|
|
218
|
+
Get the optimal swap route from the aggregator service:
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
const amount = new BN(1000000) // 1 SUI (with 6 decimals)
|
|
170
222
|
const from = "0x2::sui::SUI"
|
|
171
|
-
const target =
|
|
172
|
-
"0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS"
|
|
223
|
+
const target = "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS"
|
|
173
224
|
|
|
174
225
|
const routers = await client.findRouters({
|
|
175
226
|
from,
|
|
176
227
|
target,
|
|
177
228
|
amount,
|
|
178
|
-
byAmountIn: true, // true
|
|
229
|
+
byAmountIn: true, // true = fixed input amount, false = fixed output amount
|
|
230
|
+
// Optional parameters:
|
|
231
|
+
// depth: 3, // Maximum number of hops
|
|
232
|
+
// providers: ["CETUS", "TURBOS"], // Limit to specific DEXs
|
|
179
233
|
})
|
|
234
|
+
|
|
235
|
+
// Check if a valid route was found
|
|
236
|
+
if (!routers || routers.insufficientLiquidity) {
|
|
237
|
+
console.error("No valid route found or insufficient liquidity")
|
|
238
|
+
process.exit(1)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
console.log(`Expected output: ${routers.amountOut.toString()}`)
|
|
180
242
|
```
|
|
181
243
|
|
|
182
|
-
### 3.
|
|
244
|
+
### 3. Fast Swap (Recommended - Automatic Coin Handling)
|
|
245
|
+
|
|
246
|
+
The easiest way to execute a swap with automatic coin management:
|
|
183
247
|
|
|
184
248
|
```typescript
|
|
185
249
|
const txb = new Transaction()
|
|
186
250
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
251
|
+
await client.fastRouterSwap({
|
|
252
|
+
router: routers,
|
|
253
|
+
txb,
|
|
254
|
+
slippage: 0.01, // 1% slippage tolerance
|
|
255
|
+
// Optional:
|
|
256
|
+
// partner: "your-partner-id",
|
|
257
|
+
// payDeepFeeAmount: 1000000, // For DeepBook V3 pools
|
|
258
|
+
})
|
|
193
259
|
|
|
194
|
-
|
|
260
|
+
// Simulate the transaction first
|
|
261
|
+
const dryRunResult = await client.devInspectTransactionBlock(txb, keypair)
|
|
195
262
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
263
|
+
if (dryRunResult.effects.status.status === "success") {
|
|
264
|
+
console.log("Simulation successful, executing transaction...")
|
|
265
|
+
|
|
266
|
+
// Execute the actual transaction
|
|
267
|
+
const result = await client.signAndExecuteTransaction(txb, keypair)
|
|
268
|
+
console.log("Transaction result:", result)
|
|
269
|
+
} else {
|
|
270
|
+
console.error("Simulation failed:", dryRunResult.effects.status)
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### 4. Manual Swap (Advanced - For Custom PTB Building)
|
|
275
|
+
|
|
276
|
+
Use this when you need to build complex programmable transaction blocks:
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
import { coinWithBalance } from "@mysten/sui/transactions"
|
|
280
|
+
|
|
281
|
+
const txb = new Transaction()
|
|
282
|
+
|
|
283
|
+
// Create input coin object
|
|
284
|
+
// Option 1: From existing coin object
|
|
285
|
+
const inputCoin = txb.object("0x...") // Your coin object ID
|
|
286
|
+
|
|
287
|
+
// Option 2: Create coin with specific balance
|
|
288
|
+
// const inputCoin = coinWithBalance({
|
|
289
|
+
// type: from,
|
|
290
|
+
// balance: amount.toString()
|
|
291
|
+
// })
|
|
292
|
+
|
|
293
|
+
// Execute swap and get output coin
|
|
294
|
+
const targetCoin = await client.routerSwap({
|
|
295
|
+
router: routers,
|
|
296
|
+
txb,
|
|
297
|
+
inputCoin,
|
|
298
|
+
slippage: 0.01, // 1% slippage tolerance
|
|
299
|
+
// Optional:
|
|
300
|
+
// partner: "your-partner-id",
|
|
301
|
+
// deepbookv3DeepFee: deepCoinObject, // For DeepBook V3
|
|
302
|
+
})
|
|
303
|
+
|
|
304
|
+
// Use the target coin in your custom PTB logic
|
|
305
|
+
// For example, transfer to recipient or use in another DeFi protocol
|
|
306
|
+
txb.transferObjects([targetCoin], keypair.toSuiAddress())
|
|
307
|
+
|
|
308
|
+
// Or destroy if sending to current address
|
|
309
|
+
// client.transferOrDestroyCoin(txb, targetCoin, target)
|
|
310
|
+
|
|
311
|
+
// Simulate and execute
|
|
312
|
+
const dryRunResult = await client.devInspectTransactionBlock(txb, keypair)
|
|
313
|
+
|
|
314
|
+
if (dryRunResult.effects.status.status === "success") {
|
|
315
|
+
console.log("Simulation successful, executing transaction...")
|
|
316
|
+
const result = await client.signAndExecuteTransaction(txb, keypair)
|
|
317
|
+
console.log("Transaction result:", result)
|
|
318
|
+
} else {
|
|
319
|
+
console.error("Simulation failed:", dryRunResult.effects.status)
|
|
201
320
|
}
|
|
202
321
|
```
|
|
203
322
|
|
|
204
|
-
###
|
|
323
|
+
### 5. Advanced: Swap with Maximum Input Amount
|
|
324
|
+
|
|
325
|
+
Protect against excessive input amounts:
|
|
205
326
|
|
|
206
327
|
```typescript
|
|
207
328
|
const txb = new Transaction()
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
329
|
+
const inputCoin = txb.object("0x...") // Your coin object
|
|
330
|
+
|
|
331
|
+
const targetCoin = await client.routerSwapWithMaxAmountIn({
|
|
332
|
+
router: routers,
|
|
333
|
+
txb,
|
|
334
|
+
inputCoin,
|
|
335
|
+
slippage: 0.01,
|
|
336
|
+
maxAmountIn: new BN(2000000), // Maximum 2 SUI allowed
|
|
337
|
+
})
|
|
338
|
+
|
|
339
|
+
// Transaction will abort if input amount exceeds maxAmountIn
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### Error Handling
|
|
343
|
+
|
|
344
|
+
```typescript
|
|
345
|
+
try {
|
|
346
|
+
const routers = await client.findRouters({
|
|
347
|
+
from,
|
|
348
|
+
target,
|
|
349
|
+
amount,
|
|
350
|
+
byAmountIn: true,
|
|
216
351
|
})
|
|
217
352
|
|
|
218
|
-
|
|
219
|
-
|
|
353
|
+
if (!routers) {
|
|
354
|
+
throw new Error("No route found")
|
|
355
|
+
}
|
|
220
356
|
|
|
221
|
-
|
|
357
|
+
if (routers.insufficientLiquidity) {
|
|
358
|
+
throw new Error("Insufficient liquidity for this swap")
|
|
359
|
+
}
|
|
222
360
|
|
|
223
|
-
if (
|
|
224
|
-
|
|
225
|
-
const result = await client.signAndExecuteTransaction(txb, keypair)
|
|
361
|
+
if (routers.error) {
|
|
362
|
+
throw new Error(`Router error: ${routers.error.msg}`)
|
|
226
363
|
}
|
|
227
|
-
|
|
364
|
+
|
|
365
|
+
// Proceed with swap...
|
|
366
|
+
} catch (error) {
|
|
367
|
+
console.error("Swap failed:", error)
|
|
228
368
|
}
|
|
229
369
|
```
|
|
230
370
|
|
package/dist/index.d.mts
CHANGED
|
@@ -9,7 +9,7 @@ import { Signer } from '@mysten/sui/cryptography';
|
|
|
9
9
|
interface FindRouterParams {
|
|
10
10
|
from: string;
|
|
11
11
|
target: string;
|
|
12
|
-
amount: BN;
|
|
12
|
+
amount: BN | string | number | bigint;
|
|
13
13
|
byAmountIn: boolean;
|
|
14
14
|
depth?: number;
|
|
15
15
|
splitAlgorithm?: string;
|
|
@@ -20,11 +20,11 @@ interface FindRouterParams {
|
|
|
20
20
|
}
|
|
21
21
|
interface MergeSwapFromCoin {
|
|
22
22
|
coinType: string;
|
|
23
|
-
amount: BN | string | number;
|
|
23
|
+
amount: BN | string | number | bigint;
|
|
24
24
|
}
|
|
25
25
|
interface MergeSwapFromCoin {
|
|
26
26
|
coinType: string;
|
|
27
|
-
amount: BN | string | number;
|
|
27
|
+
amount: BN | string | number | bigint;
|
|
28
28
|
}
|
|
29
29
|
interface MergeSwapParams {
|
|
30
30
|
target: string;
|
|
@@ -394,9 +394,24 @@ declare class AggregatorClient {
|
|
|
394
394
|
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>;
|
|
395
395
|
newDexRouterV3(provider: string, pythPriceIDs: Map<string, string>, partner?: string, cetusDlmmPartner?: string): DexRouter;
|
|
396
396
|
expectInputSwapV3(txb: Transaction, inputCoin: TransactionObjectArgument, routerData: RouterDataV3, expectAmountOut: string, amountOutLimit: string, pythPriceIDs: Map<string, string>, partner?: string, cetusDlmmPartner?: string): TransactionObjectArgument;
|
|
397
|
+
expectInputSwapV3WithMaxAmountIn(txb: Transaction, inputCoin: TransactionObjectArgument, routerData: RouterDataV3, maxAmountIn: BN, expectAmountOut: string, amountOutLimit: string, pythPriceIDs: Map<string, string>, partner?: string, cetusDlmmPartner?: string): TransactionObjectArgument;
|
|
397
398
|
expectOutputSwapV3(txb: Transaction, inputCoin: TransactionObjectArgument, routerData: RouterDataV3, amountOut: string, _amountLimit: string, // it will set when build inputcoin
|
|
398
399
|
partner?: string): TransactionObjectArgument;
|
|
400
|
+
expectOutputSwapV3WithMaxAmountIn(txb: Transaction, inputCoin: TransactionObjectArgument, routerData: RouterDataV3, maxAmountIn: BN, amountOut: string, _amountLimit: string, // it will set when build inputcoin
|
|
401
|
+
partner?: string): TransactionObjectArgument;
|
|
399
402
|
routerSwap(params: BuildRouterSwapParamsV3): Promise<TransactionObjectArgument>;
|
|
403
|
+
/**
|
|
404
|
+
* Router swap with max amount in validation.
|
|
405
|
+
* This method validates that the input coin amount does not exceed maxAmountIn.
|
|
406
|
+
* If the validation fails, the transaction will abort with an error.
|
|
407
|
+
*
|
|
408
|
+
* @param params - Router swap parameters with maxAmountIn
|
|
409
|
+
* @returns TransactionObjectArgument - The output coin from the swap
|
|
410
|
+
* @throws Error if input coin amount exceeds maxAmountIn
|
|
411
|
+
*/
|
|
412
|
+
routerSwapWithMaxAmountIn(params: BuildRouterSwapParamsV3 & {
|
|
413
|
+
maxAmountIn: BN;
|
|
414
|
+
}): Promise<TransactionObjectArgument>;
|
|
400
415
|
fastRouterSwap(params: BuildFastRouterSwapParamsV3): Promise<void>;
|
|
401
416
|
mergeSwap(params: BuildMergeSwapParams): Promise<TransactionObjectArgument>;
|
|
402
417
|
fastMergeSwap(params: BuildFastMergeSwapParams): Promise<void>;
|
|
@@ -708,9 +723,8 @@ declare const SuiZeroCoinFn = "0x2::coin::zero";
|
|
|
708
723
|
declare const DEEPBOOK_PACKAGE_ID = "0x000000000000000000000000000000000000000000000000000000000000dee9";
|
|
709
724
|
declare const DEEPBOOK_PUBLISHED_AT = "0x000000000000000000000000000000000000000000000000000000000000dee9";
|
|
710
725
|
declare const CETUS_PUBLISHED_AT = "0x70968826ad1b4ba895753f634b0aea68d0672908ca1075a2abdf0fc9e0b2fc6a";
|
|
711
|
-
declare const
|
|
712
|
-
declare const
|
|
713
|
-
declare const TESTNET_CETUS_GLOBAL_CONFIG_ID = "0x6f4149091a5aea0e818e7243a13adcfb403842d670b9a2089de058512620687a";
|
|
726
|
+
declare const MAINNET_CETUS_V3_PUBLISHED_AT = "0xd7b0cfc33a3b46c0ae0e2584c44028385da11724d4c94ec5b21a78117c5c1ab9";
|
|
727
|
+
declare const TESTNET_CETUS_V3_PUBLISHED_AT = "0x7a82ed4b00a8c68d751b6c0cbd4e989691daa4716a1cf4f875c2f9b28fb72f3a";
|
|
714
728
|
declare const MAINNET_FLOWX_AMM_CONTAINER_ID = "0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511";
|
|
715
729
|
declare const TESTNET_FLOWX_AMM_CONTAINER_ID = "";
|
|
716
730
|
declare const TURBOS_VERSIONED = "0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f";
|
|
@@ -783,8 +797,8 @@ declare const AGGREGATOR_V3_CONFIG: {
|
|
|
783
797
|
readonly MAX_FEE_RATE: 100000;
|
|
784
798
|
readonly MAX_AMOUNT_IN: "18446744073709551615";
|
|
785
799
|
readonly DEFAULT_PUBLISHED_AT: {
|
|
786
|
-
readonly Mainnet: "
|
|
787
|
-
readonly Testnet: "
|
|
800
|
+
readonly Mainnet: "0xde5d696a79714ca5cb910b9aed99d41f67353abb00715ceaeb0663d57ee39640";
|
|
801
|
+
readonly Testnet: "0x61da681cf2af95cb214a71596b49e662290065536984ed7e06b47e701ef547e3";
|
|
788
802
|
};
|
|
789
803
|
};
|
|
790
804
|
|
|
@@ -995,4 +1009,4 @@ declare class CoinUtils {
|
|
|
995
1009
|
static calculateTotalBalance(coins: CoinAsset[]): bigint;
|
|
996
1010
|
}
|
|
997
1011
|
|
|
998
|
-
export { AFSUI, AFTERMATH, AFTERMATH_AMM, AFTERMATH_MODULE, AGGREGATOR, AGGREGATOR_V3_CONFIG, ALL_DEXES, ALPHAFI, AggregatorClient, type AggregatorClientParams, AggregatorConfig, AggregatorError, type AggregatorErrorCode, type AggregatorResponse, AggregatorServerErrorCode, BLUEFIN, BLUEMOVE, type BigNumber, type BuildCoinResult, type BuildFastMergeSwapParams, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildFastRouterSwapParamsV3, type BuildMergeSwapParams, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, type BuildRouterSwapParamsV3, CETUS, CETUSDLMM, CETUS_DEX, CETUS_MODULE, CETUS_PUBLISHED_AT,
|
|
1012
|
+
export { AFSUI, AFTERMATH, AFTERMATH_AMM, AFTERMATH_MODULE, AGGREGATOR, AGGREGATOR_V3_CONFIG, ALL_DEXES, ALPHAFI, AggregatorClient, type AggregatorClientParams, AggregatorConfig, AggregatorError, type AggregatorErrorCode, type AggregatorResponse, AggregatorServerErrorCode, BLUEFIN, BLUEMOVE, type BigNumber, type BuildCoinResult, type BuildFastMergeSwapParams, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildFastRouterSwapParamsV3, type BuildMergeSwapParams, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, type BuildRouterSwapParamsV3, CETUS, CETUSDLMM, CETUS_DEX, CETUS_MODULE, CETUS_PUBLISHED_AT, CHECK_COINS_THRESHOLD_FUNC, CLIENT_CONFIG, CLOCK_ADDRESS, type CoinAsset, CoinInfoAddress, CoinStoreAddress, CoinUtils, type ComparisonResult, ConfigErrorCode, DEEPBOOKV2, DEEPBOOKV3, DEEPBOOK_CLOB_V2_MODULE, DEEPBOOK_CUSTODIAN_V2_MODULE, DEEPBOOK_DEX, DEEPBOOK_MODULE, DEEPBOOK_PACKAGE_ID, DEEPBOOK_PUBLISHED_AT, DEEPBOOK_V3_DEEP_FEE_TYPES, DEFAULT_AGG_V2_ENDPOINT, DEFAULT_AGG_V3_ENDPOINT, DEFAULT_ENDPOINT, DEFAULT_GAS_BUDGET_FOR_MERGE, DEFAULT_GAS_BUDGET_FOR_SPLIT, DEFAULT_GAS_BUDGET_FOR_STAKE, DEFAULT_GAS_BUDGET_FOR_TRANSFER, DEFAULT_GAS_BUDGET_FOR_TRANSFER_SUI, DEFAULT_NFT_TRANSFER_GAS_FEE, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FERRACLMM, FERRADLMM, FLOWXV2, FLOWXV3, FLOWX_AMM, FLOWX_AMM_MODULE, FULLSAIL, type FindRouterParams, FlashSwapA2BFunc, FlashSwapB2AFunc, FlashSwapFunc, FlashSwapWithPartnerA2BFunc, FlashSwapWithPartnerB2AFunc, FlashSwapWithPartnerFunc, type FlattenedPath, GAS_SYMBOL, GAS_TYPE_ARG, GAS_TYPE_ARG_LONG, type GasMetrics, type GetOrCreateAccountCapResult, HAEDAL, HAEDALHMMV2, HAEDALPMM, HAWAL, INTEGRATE, JOIN_FUNC, KRIYA, KRIYAV3, KRIYA_DEX, KRIYA_MODULE, MAGMA, MAINNET_AFTERMATH_INSURANCE_FUND_ID, MAINNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID, MAINNET_AFTERMATH_REFERRAL_VAULT_ID, MAINNET_AFTERMATH_REGISTRY_ID, MAINNET_AFTERMATH_TREASURY_ID, MAINNET_CETUS_V3_PUBLISHED_AT, MAINNET_FLOWX_AMM_CONTAINER_ID, METASTABLE, MOMENTUM, type MergeRoute, type MergeSwapFromCoin, type MergeSwapInputCoin, type MergeSwapParams, type MergeSwapRouterData, type NFT, OBRIC, ONE, PACKAGE_NAMES, PAY_MODULE, POOL_MODULT, PUBLISHED_ADDRESSES, PYTH_CONFIG, type Package, type Path, type PathV2, type PreSwapLpChangeParams, type ProcessedRouterData, type PythConfig, REPAY_FLASH_SWAP_A2B_FUNC, REPAY_FLASH_SWAP_B2A_FUNC, REPAY_FLASH_SWAP_WITH_PARTNER_A2B_FUNC, REPAY_FLASH_SWAP_WITH_PARTNER_B2A_FUNC, RepayFalshSwapFunc, RepayFlashSwapWithPartnerFunc, type Router, type RouterData, type RouterDataV2, type RouterDataV3, type RouterError, type RouterV2, SCALLOP, SEVENK, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, SUI_SYSTEM_STATE_OBJECT_ID, SWAP_A2B_FUNC, SWAP_B2A_FUNC, type SuiAddress, type SuiBasicTypes, type SuiInputTypes, type SuiObjectIdType, type SuiResource, type SuiStructTag, type SuiTxArg, SuiZeroCoinFn, type SwapGasAnalysis, type SwapInPoolsParams, type SwapInPoolsResultV3, TEN_POW_NINE, TESTNET_AFTERMATH_INSURANCE_FUND_ID, TESTNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID, TESTNET_AFTERMATH_REFERRAL_VAULT_ID, TESTNET_AFTERMATH_REGISTRY_ID, TESTNET_AFTERMATH_TREASURY_ID, TESTNET_CETUS_V3_PUBLISHED_AT, TESTNET_FLOWX_AMM_CONTAINER_ID, TRANSFER_ACCOUNT_CAP, TRANSFER_OR_DESTORY_COIN_FUNC, TURBOS, TURBOS_DEX, TURBOS_MODULE, TURBOS_VERSIONED, TWO, TransactionErrorCode, TypesErrorCode, U128, U64_MAX, U64_MAX_BN, UTILS_MODULE, VOLO, ZERO, buildInputCoin, calculateGasEfficiency, calculatePriceImpact, checkInvalidSuiAddress, compareCoins, compareGasMetrics, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, exportToCSV, exportToJSON, extractAddressFromType, extractGasMetrics, extractStructTagFromType, extractTimestampFromDowngradeUuid6, fixSuiObjectId, formatGasMetrics, generateDowngradeUuid6, generateSimpleDowngradeUuid6, getAggregatorServerErrorMessage, getAggregatorV2Extend2PublishedAt, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getAllProviders, getDeepbookV3Config, getDefaultSuiInputType, getMergeSwapResult, getOrCreateAccountCap, getProvidersExcluding, getProvidersIncluding, getRouterResult, isSortedSymbols, isValidDowngradeUuid6, mintZeroCoin, normalizeCoinType, parseAftermathFeeType, parseTurbosPoolFeeType, patchFixSuiObjectId, printTransaction, processEndpoint, processFlattenRoutes, restituteMsafeFastRouterSwapParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { Signer } from '@mysten/sui/cryptography';
|
|
|
9
9
|
interface FindRouterParams {
|
|
10
10
|
from: string;
|
|
11
11
|
target: string;
|
|
12
|
-
amount: BN;
|
|
12
|
+
amount: BN | string | number | bigint;
|
|
13
13
|
byAmountIn: boolean;
|
|
14
14
|
depth?: number;
|
|
15
15
|
splitAlgorithm?: string;
|
|
@@ -20,11 +20,11 @@ interface FindRouterParams {
|
|
|
20
20
|
}
|
|
21
21
|
interface MergeSwapFromCoin {
|
|
22
22
|
coinType: string;
|
|
23
|
-
amount: BN | string | number;
|
|
23
|
+
amount: BN | string | number | bigint;
|
|
24
24
|
}
|
|
25
25
|
interface MergeSwapFromCoin {
|
|
26
26
|
coinType: string;
|
|
27
|
-
amount: BN | string | number;
|
|
27
|
+
amount: BN | string | number | bigint;
|
|
28
28
|
}
|
|
29
29
|
interface MergeSwapParams {
|
|
30
30
|
target: string;
|
|
@@ -394,9 +394,24 @@ declare class AggregatorClient {
|
|
|
394
394
|
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>;
|
|
395
395
|
newDexRouterV3(provider: string, pythPriceIDs: Map<string, string>, partner?: string, cetusDlmmPartner?: string): DexRouter;
|
|
396
396
|
expectInputSwapV3(txb: Transaction, inputCoin: TransactionObjectArgument, routerData: RouterDataV3, expectAmountOut: string, amountOutLimit: string, pythPriceIDs: Map<string, string>, partner?: string, cetusDlmmPartner?: string): TransactionObjectArgument;
|
|
397
|
+
expectInputSwapV3WithMaxAmountIn(txb: Transaction, inputCoin: TransactionObjectArgument, routerData: RouterDataV3, maxAmountIn: BN, expectAmountOut: string, amountOutLimit: string, pythPriceIDs: Map<string, string>, partner?: string, cetusDlmmPartner?: string): TransactionObjectArgument;
|
|
397
398
|
expectOutputSwapV3(txb: Transaction, inputCoin: TransactionObjectArgument, routerData: RouterDataV3, amountOut: string, _amountLimit: string, // it will set when build inputcoin
|
|
398
399
|
partner?: string): TransactionObjectArgument;
|
|
400
|
+
expectOutputSwapV3WithMaxAmountIn(txb: Transaction, inputCoin: TransactionObjectArgument, routerData: RouterDataV3, maxAmountIn: BN, amountOut: string, _amountLimit: string, // it will set when build inputcoin
|
|
401
|
+
partner?: string): TransactionObjectArgument;
|
|
399
402
|
routerSwap(params: BuildRouterSwapParamsV3): Promise<TransactionObjectArgument>;
|
|
403
|
+
/**
|
|
404
|
+
* Router swap with max amount in validation.
|
|
405
|
+
* This method validates that the input coin amount does not exceed maxAmountIn.
|
|
406
|
+
* If the validation fails, the transaction will abort with an error.
|
|
407
|
+
*
|
|
408
|
+
* @param params - Router swap parameters with maxAmountIn
|
|
409
|
+
* @returns TransactionObjectArgument - The output coin from the swap
|
|
410
|
+
* @throws Error if input coin amount exceeds maxAmountIn
|
|
411
|
+
*/
|
|
412
|
+
routerSwapWithMaxAmountIn(params: BuildRouterSwapParamsV3 & {
|
|
413
|
+
maxAmountIn: BN;
|
|
414
|
+
}): Promise<TransactionObjectArgument>;
|
|
400
415
|
fastRouterSwap(params: BuildFastRouterSwapParamsV3): Promise<void>;
|
|
401
416
|
mergeSwap(params: BuildMergeSwapParams): Promise<TransactionObjectArgument>;
|
|
402
417
|
fastMergeSwap(params: BuildFastMergeSwapParams): Promise<void>;
|
|
@@ -708,9 +723,8 @@ declare const SuiZeroCoinFn = "0x2::coin::zero";
|
|
|
708
723
|
declare const DEEPBOOK_PACKAGE_ID = "0x000000000000000000000000000000000000000000000000000000000000dee9";
|
|
709
724
|
declare const DEEPBOOK_PUBLISHED_AT = "0x000000000000000000000000000000000000000000000000000000000000dee9";
|
|
710
725
|
declare const CETUS_PUBLISHED_AT = "0x70968826ad1b4ba895753f634b0aea68d0672908ca1075a2abdf0fc9e0b2fc6a";
|
|
711
|
-
declare const
|
|
712
|
-
declare const
|
|
713
|
-
declare const TESTNET_CETUS_GLOBAL_CONFIG_ID = "0x6f4149091a5aea0e818e7243a13adcfb403842d670b9a2089de058512620687a";
|
|
726
|
+
declare const MAINNET_CETUS_V3_PUBLISHED_AT = "0xd7b0cfc33a3b46c0ae0e2584c44028385da11724d4c94ec5b21a78117c5c1ab9";
|
|
727
|
+
declare const TESTNET_CETUS_V3_PUBLISHED_AT = "0x7a82ed4b00a8c68d751b6c0cbd4e989691daa4716a1cf4f875c2f9b28fb72f3a";
|
|
714
728
|
declare const MAINNET_FLOWX_AMM_CONTAINER_ID = "0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511";
|
|
715
729
|
declare const TESTNET_FLOWX_AMM_CONTAINER_ID = "";
|
|
716
730
|
declare const TURBOS_VERSIONED = "0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f";
|
|
@@ -783,8 +797,8 @@ declare const AGGREGATOR_V3_CONFIG: {
|
|
|
783
797
|
readonly MAX_FEE_RATE: 100000;
|
|
784
798
|
readonly MAX_AMOUNT_IN: "18446744073709551615";
|
|
785
799
|
readonly DEFAULT_PUBLISHED_AT: {
|
|
786
|
-
readonly Mainnet: "
|
|
787
|
-
readonly Testnet: "
|
|
800
|
+
readonly Mainnet: "0xde5d696a79714ca5cb910b9aed99d41f67353abb00715ceaeb0663d57ee39640";
|
|
801
|
+
readonly Testnet: "0x61da681cf2af95cb214a71596b49e662290065536984ed7e06b47e701ef547e3";
|
|
788
802
|
};
|
|
789
803
|
};
|
|
790
804
|
|
|
@@ -995,4 +1009,4 @@ declare class CoinUtils {
|
|
|
995
1009
|
static calculateTotalBalance(coins: CoinAsset[]): bigint;
|
|
996
1010
|
}
|
|
997
1011
|
|
|
998
|
-
export { AFSUI, AFTERMATH, AFTERMATH_AMM, AFTERMATH_MODULE, AGGREGATOR, AGGREGATOR_V3_CONFIG, ALL_DEXES, ALPHAFI, AggregatorClient, type AggregatorClientParams, AggregatorConfig, AggregatorError, type AggregatorErrorCode, type AggregatorResponse, AggregatorServerErrorCode, BLUEFIN, BLUEMOVE, type BigNumber, type BuildCoinResult, type BuildFastMergeSwapParams, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildFastRouterSwapParamsV3, type BuildMergeSwapParams, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, type BuildRouterSwapParamsV3, CETUS, CETUSDLMM, CETUS_DEX, CETUS_MODULE, CETUS_PUBLISHED_AT,
|
|
1012
|
+
export { AFSUI, AFTERMATH, AFTERMATH_AMM, AFTERMATH_MODULE, AGGREGATOR, AGGREGATOR_V3_CONFIG, ALL_DEXES, ALPHAFI, AggregatorClient, type AggregatorClientParams, AggregatorConfig, AggregatorError, type AggregatorErrorCode, type AggregatorResponse, AggregatorServerErrorCode, BLUEFIN, BLUEMOVE, type BigNumber, type BuildCoinResult, type BuildFastMergeSwapParams, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildFastRouterSwapParamsV3, type BuildMergeSwapParams, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, type BuildRouterSwapParamsV3, CETUS, CETUSDLMM, CETUS_DEX, CETUS_MODULE, CETUS_PUBLISHED_AT, CHECK_COINS_THRESHOLD_FUNC, CLIENT_CONFIG, CLOCK_ADDRESS, type CoinAsset, CoinInfoAddress, CoinStoreAddress, CoinUtils, type ComparisonResult, ConfigErrorCode, DEEPBOOKV2, DEEPBOOKV3, DEEPBOOK_CLOB_V2_MODULE, DEEPBOOK_CUSTODIAN_V2_MODULE, DEEPBOOK_DEX, DEEPBOOK_MODULE, DEEPBOOK_PACKAGE_ID, DEEPBOOK_PUBLISHED_AT, DEEPBOOK_V3_DEEP_FEE_TYPES, DEFAULT_AGG_V2_ENDPOINT, DEFAULT_AGG_V3_ENDPOINT, DEFAULT_ENDPOINT, DEFAULT_GAS_BUDGET_FOR_MERGE, DEFAULT_GAS_BUDGET_FOR_SPLIT, DEFAULT_GAS_BUDGET_FOR_STAKE, DEFAULT_GAS_BUDGET_FOR_TRANSFER, DEFAULT_GAS_BUDGET_FOR_TRANSFER_SUI, DEFAULT_NFT_TRANSFER_GAS_FEE, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FERRACLMM, FERRADLMM, FLOWXV2, FLOWXV3, FLOWX_AMM, FLOWX_AMM_MODULE, FULLSAIL, type FindRouterParams, FlashSwapA2BFunc, FlashSwapB2AFunc, FlashSwapFunc, FlashSwapWithPartnerA2BFunc, FlashSwapWithPartnerB2AFunc, FlashSwapWithPartnerFunc, type FlattenedPath, GAS_SYMBOL, GAS_TYPE_ARG, GAS_TYPE_ARG_LONG, type GasMetrics, type GetOrCreateAccountCapResult, HAEDAL, HAEDALHMMV2, HAEDALPMM, HAWAL, INTEGRATE, JOIN_FUNC, KRIYA, KRIYAV3, KRIYA_DEX, KRIYA_MODULE, MAGMA, MAINNET_AFTERMATH_INSURANCE_FUND_ID, MAINNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID, MAINNET_AFTERMATH_REFERRAL_VAULT_ID, MAINNET_AFTERMATH_REGISTRY_ID, MAINNET_AFTERMATH_TREASURY_ID, MAINNET_CETUS_V3_PUBLISHED_AT, MAINNET_FLOWX_AMM_CONTAINER_ID, METASTABLE, MOMENTUM, type MergeRoute, type MergeSwapFromCoin, type MergeSwapInputCoin, type MergeSwapParams, type MergeSwapRouterData, type NFT, OBRIC, ONE, PACKAGE_NAMES, PAY_MODULE, POOL_MODULT, PUBLISHED_ADDRESSES, PYTH_CONFIG, type Package, type Path, type PathV2, type PreSwapLpChangeParams, type ProcessedRouterData, type PythConfig, REPAY_FLASH_SWAP_A2B_FUNC, REPAY_FLASH_SWAP_B2A_FUNC, REPAY_FLASH_SWAP_WITH_PARTNER_A2B_FUNC, REPAY_FLASH_SWAP_WITH_PARTNER_B2A_FUNC, RepayFalshSwapFunc, RepayFlashSwapWithPartnerFunc, type Router, type RouterData, type RouterDataV2, type RouterDataV3, type RouterError, type RouterV2, SCALLOP, SEVENK, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, SUI_SYSTEM_STATE_OBJECT_ID, SWAP_A2B_FUNC, SWAP_B2A_FUNC, type SuiAddress, type SuiBasicTypes, type SuiInputTypes, type SuiObjectIdType, type SuiResource, type SuiStructTag, type SuiTxArg, SuiZeroCoinFn, type SwapGasAnalysis, type SwapInPoolsParams, type SwapInPoolsResultV3, TEN_POW_NINE, TESTNET_AFTERMATH_INSURANCE_FUND_ID, TESTNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID, TESTNET_AFTERMATH_REFERRAL_VAULT_ID, TESTNET_AFTERMATH_REGISTRY_ID, TESTNET_AFTERMATH_TREASURY_ID, TESTNET_CETUS_V3_PUBLISHED_AT, TESTNET_FLOWX_AMM_CONTAINER_ID, TRANSFER_ACCOUNT_CAP, TRANSFER_OR_DESTORY_COIN_FUNC, TURBOS, TURBOS_DEX, TURBOS_MODULE, TURBOS_VERSIONED, TWO, TransactionErrorCode, TypesErrorCode, U128, U64_MAX, U64_MAX_BN, UTILS_MODULE, VOLO, ZERO, buildInputCoin, calculateGasEfficiency, calculatePriceImpact, checkInvalidSuiAddress, compareCoins, compareGasMetrics, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, exportToCSV, exportToJSON, extractAddressFromType, extractGasMetrics, extractStructTagFromType, extractTimestampFromDowngradeUuid6, fixSuiObjectId, formatGasMetrics, generateDowngradeUuid6, generateSimpleDowngradeUuid6, getAggregatorServerErrorMessage, getAggregatorV2Extend2PublishedAt, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getAllProviders, getDeepbookV3Config, getDefaultSuiInputType, getMergeSwapResult, getOrCreateAccountCap, getProvidersExcluding, getProvidersIncluding, getRouterResult, isSortedSymbols, isValidDowngradeUuid6, mintZeroCoin, normalizeCoinType, parseAftermathFeeType, parseTurbosPoolFeeType, patchFixSuiObjectId, printTransaction, processEndpoint, processFlattenRoutes, restituteMsafeFastRouterSwapParams };
|
package/dist/index.js
CHANGED
|
@@ -3365,9 +3365,8 @@ var SuiZeroCoinFn = "0x2::coin::zero";
|
|
|
3365
3365
|
var DEEPBOOK_PACKAGE_ID = "0x000000000000000000000000000000000000000000000000000000000000dee9";
|
|
3366
3366
|
var DEEPBOOK_PUBLISHED_AT = "0x000000000000000000000000000000000000000000000000000000000000dee9";
|
|
3367
3367
|
var CETUS_PUBLISHED_AT = "0x70968826ad1b4ba895753f634b0aea68d0672908ca1075a2abdf0fc9e0b2fc6a";
|
|
3368
|
-
var
|
|
3369
|
-
var
|
|
3370
|
-
var TESTNET_CETUS_GLOBAL_CONFIG_ID = "0x6f4149091a5aea0e818e7243a13adcfb403842d670b9a2089de058512620687a";
|
|
3368
|
+
var MAINNET_CETUS_V3_PUBLISHED_AT = "0xd7b0cfc33a3b46c0ae0e2584c44028385da11724d4c94ec5b21a78117c5c1ab9";
|
|
3369
|
+
var TESTNET_CETUS_V3_PUBLISHED_AT = "0x7a82ed4b00a8c68d751b6c0cbd4e989691daa4716a1cf4f875c2f9b28fb72f3a";
|
|
3371
3370
|
var MAINNET_FLOWX_AMM_CONTAINER_ID = "0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511";
|
|
3372
3371
|
var TESTNET_FLOWX_AMM_CONTAINER_ID = "";
|
|
3373
3372
|
var TURBOS_VERSIONED = "0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f";
|
|
@@ -3447,13 +3446,13 @@ var AGGREGATOR_V3_CONFIG = {
|
|
|
3447
3446
|
// 10%
|
|
3448
3447
|
MAX_AMOUNT_IN: U64_MAX,
|
|
3449
3448
|
DEFAULT_PUBLISHED_AT: {
|
|
3450
|
-
Mainnet: "
|
|
3451
|
-
Testnet: "
|
|
3449
|
+
Mainnet: "0xde5d696a79714ca5cb910b9aed99d41f67353abb00715ceaeb0663d57ee39640",
|
|
3450
|
+
Testnet: "0x61da681cf2af95cb214a71596b49e662290065536984ed7e06b47e701ef547e3"
|
|
3452
3451
|
}
|
|
3453
3452
|
};
|
|
3454
3453
|
|
|
3455
3454
|
// src/api.ts
|
|
3456
|
-
var SDK_VERSION =
|
|
3455
|
+
var SDK_VERSION = 1010401;
|
|
3457
3456
|
function parseRouterResponse(data, byAmountIn) {
|
|
3458
3457
|
let packages = /* @__PURE__ */ new Map();
|
|
3459
3458
|
if (data.packages) {
|
|
@@ -6104,11 +6103,8 @@ function CalculateAmountLimitByDecimal(expectAmount, byAmountIn, slippage) {
|
|
|
6104
6103
|
}
|
|
6105
6104
|
var CetusRouter = class {
|
|
6106
6105
|
constructor(env, partner) {
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
}
|
|
6110
|
-
this.globalConfig = env === 0 /* Mainnet */ ? "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f" : "0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e";
|
|
6111
|
-
this.partner = partner != null ? partner : env === 0 /* Mainnet */ ? "0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b" : "0x1f5fa5c820f40d43fc47815ad06d95e40a1942ff72a732a92e8ef4aa8cde70a5";
|
|
6106
|
+
this.globalConfig = env === 0 /* Mainnet */ ? "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f" : "0xc6273f844b4bc258952c4e477697aa12c918c8e08106fac6b934811298c9820a";
|
|
6107
|
+
this.partner = partner != null ? partner : env === 0 /* Mainnet */ ? "0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b" : "0xfdc30896f88f74544fd507722d3bf52e46b06412ba8241ba0e854cbc65f8d85f";
|
|
6112
6108
|
}
|
|
6113
6109
|
// By amount in
|
|
6114
6110
|
swap(txb, flattenedPath, swapContext, _extends) {
|
|
@@ -7759,6 +7755,37 @@ function newSwapContext(params, txb) {
|
|
|
7759
7755
|
});
|
|
7760
7756
|
return swap_context;
|
|
7761
7757
|
}
|
|
7758
|
+
function newSwapContextV2(params, txb) {
|
|
7759
|
+
const {
|
|
7760
|
+
quoteID,
|
|
7761
|
+
fromCoinType,
|
|
7762
|
+
targetCoinType,
|
|
7763
|
+
maxAmountIn,
|
|
7764
|
+
expectAmountOut,
|
|
7765
|
+
amountOutLimit,
|
|
7766
|
+
inputCoin,
|
|
7767
|
+
feeRate,
|
|
7768
|
+
feeRecipient,
|
|
7769
|
+
aggregatorPublishedAt,
|
|
7770
|
+
packages
|
|
7771
|
+
} = params;
|
|
7772
|
+
const publishedAt = getAggregatorPublishedAt(packages, aggregatorPublishedAt);
|
|
7773
|
+
const args = [
|
|
7774
|
+
txb.pure.string(quoteID),
|
|
7775
|
+
txb.pure.u64(maxAmountIn.toString()),
|
|
7776
|
+
txb.pure.u64(expectAmountOut.toString()),
|
|
7777
|
+
txb.pure.u64(amountOutLimit.toString()),
|
|
7778
|
+
inputCoin,
|
|
7779
|
+
txb.pure.u32(Number(feeRate.toString())),
|
|
7780
|
+
txb.pure.address(feeRecipient)
|
|
7781
|
+
];
|
|
7782
|
+
const swap_context = txb.moveCall({
|
|
7783
|
+
target: `${publishedAt}::router::new_swap_context_v2`,
|
|
7784
|
+
typeArguments: [fromCoinType, targetCoinType],
|
|
7785
|
+
arguments: args
|
|
7786
|
+
});
|
|
7787
|
+
return swap_context;
|
|
7788
|
+
}
|
|
7762
7789
|
function confirmSwap(params, txb) {
|
|
7763
7790
|
const { swapContext, targetCoinType, aggregatorPublishedAt, packages } = params;
|
|
7764
7791
|
const publishedAt = getAggregatorPublishedAt(packages, aggregatorPublishedAt);
|
|
@@ -8760,6 +8787,53 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
8760
8787
|
);
|
|
8761
8788
|
return outputCoin;
|
|
8762
8789
|
}
|
|
8790
|
+
expectInputSwapV3WithMaxAmountIn(txb, inputCoin, routerData, maxAmountIn, expectAmountOut, amountOutLimit, pythPriceIDs, partner, cetusDlmmPartner) {
|
|
8791
|
+
if (routerData.quoteID == null) {
|
|
8792
|
+
throw new Error(CLIENT_CONFIG.ERRORS.QUOTE_ID_REQUIRED);
|
|
8793
|
+
}
|
|
8794
|
+
const processedData = processFlattenRoutes(routerData);
|
|
8795
|
+
const swapCtx = newSwapContextV2(
|
|
8796
|
+
{
|
|
8797
|
+
quoteID: processedData.quoteID,
|
|
8798
|
+
fromCoinType: processedData.fromCoinType,
|
|
8799
|
+
targetCoinType: processedData.targetCoinType,
|
|
8800
|
+
maxAmountIn,
|
|
8801
|
+
expectAmountOut,
|
|
8802
|
+
amountOutLimit,
|
|
8803
|
+
inputCoin,
|
|
8804
|
+
feeRate: this.overlayFeeRate,
|
|
8805
|
+
feeRecipient: this.overlayFeeReceiver,
|
|
8806
|
+
packages: processedData.packages
|
|
8807
|
+
},
|
|
8808
|
+
txb
|
|
8809
|
+
);
|
|
8810
|
+
let dexRouters = /* @__PURE__ */ new Map();
|
|
8811
|
+
for (const flattenedPath of processedData.flattenedPaths) {
|
|
8812
|
+
const path = flattenedPath.path;
|
|
8813
|
+
if (!dexRouters.has(path.provider)) {
|
|
8814
|
+
dexRouters.set(
|
|
8815
|
+
path.provider,
|
|
8816
|
+
this.newDexRouterV3(
|
|
8817
|
+
path.provider,
|
|
8818
|
+
pythPriceIDs,
|
|
8819
|
+
partner,
|
|
8820
|
+
cetusDlmmPartner
|
|
8821
|
+
)
|
|
8822
|
+
);
|
|
8823
|
+
}
|
|
8824
|
+
const dex = dexRouters.get(path.provider);
|
|
8825
|
+
dex.swap(txb, flattenedPath, swapCtx, { pythPriceIDs });
|
|
8826
|
+
}
|
|
8827
|
+
const outputCoin = confirmSwap(
|
|
8828
|
+
{
|
|
8829
|
+
swapContext: swapCtx,
|
|
8830
|
+
targetCoinType: processedData.targetCoinType,
|
|
8831
|
+
packages: processedData.packages
|
|
8832
|
+
},
|
|
8833
|
+
txb
|
|
8834
|
+
);
|
|
8835
|
+
return outputCoin;
|
|
8836
|
+
}
|
|
8763
8837
|
expectOutputSwapV3(txb, inputCoin, routerData, amountOut, _amountLimit, partner) {
|
|
8764
8838
|
const receipts = [];
|
|
8765
8839
|
const dex = new CetusRouter(this.env, partner);
|
|
@@ -8869,6 +8943,116 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
8869
8943
|
);
|
|
8870
8944
|
return outputCoin;
|
|
8871
8945
|
}
|
|
8946
|
+
expectOutputSwapV3WithMaxAmountIn(txb, inputCoin, routerData, maxAmountIn, amountOut, _amountLimit, partner) {
|
|
8947
|
+
const receipts = [];
|
|
8948
|
+
const dex = new CetusRouter(this.env, partner);
|
|
8949
|
+
const processedData = processFlattenRoutes(routerData);
|
|
8950
|
+
const swapCtx = newSwapContextV2(
|
|
8951
|
+
{
|
|
8952
|
+
quoteID: processedData.quoteID,
|
|
8953
|
+
fromCoinType: processedData.fromCoinType,
|
|
8954
|
+
targetCoinType: processedData.targetCoinType,
|
|
8955
|
+
maxAmountIn,
|
|
8956
|
+
expectAmountOut: amountOut,
|
|
8957
|
+
amountOutLimit: amountOut,
|
|
8958
|
+
// amountOutLimit equals expectAmountOut when fix amout out
|
|
8959
|
+
inputCoin,
|
|
8960
|
+
feeRate: this.overlayFeeRate,
|
|
8961
|
+
feeRecipient: this.overlayFeeReceiver,
|
|
8962
|
+
packages: processedData.packages
|
|
8963
|
+
},
|
|
8964
|
+
txb
|
|
8965
|
+
);
|
|
8966
|
+
const firstCoinRecord = recordFirstCoinIndex(routerData.paths);
|
|
8967
|
+
let needRepayRecord = /* @__PURE__ */ new Map();
|
|
8968
|
+
let payRecord = /* @__PURE__ */ new Map();
|
|
8969
|
+
for (let j = routerData.paths.length - 1; j >= 0; j--) {
|
|
8970
|
+
const path = routerData.paths[j];
|
|
8971
|
+
const firstFromTokenIndex = firstCoinRecord.get(path.from);
|
|
8972
|
+
let amountArg;
|
|
8973
|
+
if (j !== firstFromTokenIndex || path.target === processedData.targetCoinType) {
|
|
8974
|
+
if (path.target !== processedData.targetCoinType) {
|
|
8975
|
+
let payAmount = BigInt(path.amountOut);
|
|
8976
|
+
if (payRecord.has(path.target)) {
|
|
8977
|
+
const oldPayAmount = payRecord.get(path.target);
|
|
8978
|
+
payAmount = oldPayAmount + payAmount;
|
|
8979
|
+
}
|
|
8980
|
+
payRecord.set(path.target, payAmount);
|
|
8981
|
+
}
|
|
8982
|
+
amountArg = txb.pure.u64(
|
|
8983
|
+
path.amountOut.toString()
|
|
8984
|
+
);
|
|
8985
|
+
} else {
|
|
8986
|
+
if (!needRepayRecord.has(path.target)) {
|
|
8987
|
+
throw Error("no need repay record");
|
|
8988
|
+
}
|
|
8989
|
+
if (payRecord.has(path.target)) {
|
|
8990
|
+
const oldPayAmount = payRecord.get(path.target);
|
|
8991
|
+
const oldNeedRepay = needRepayRecord.get(path.target);
|
|
8992
|
+
amountArg = dex.sub(
|
|
8993
|
+
txb,
|
|
8994
|
+
oldNeedRepay,
|
|
8995
|
+
txb.pure.u64(oldPayAmount),
|
|
8996
|
+
path.publishedAt
|
|
8997
|
+
);
|
|
8998
|
+
} else {
|
|
8999
|
+
amountArg = needRepayRecord.get(path.target);
|
|
9000
|
+
}
|
|
9001
|
+
}
|
|
9002
|
+
const flashSwapResult = dex.flashSwapFixedOutput(
|
|
9003
|
+
txb,
|
|
9004
|
+
path,
|
|
9005
|
+
amountArg,
|
|
9006
|
+
swapCtx
|
|
9007
|
+
);
|
|
9008
|
+
receipts.unshift(flashSwapResult.flashReceipt);
|
|
9009
|
+
if (needRepayRecord.has(path.from)) {
|
|
9010
|
+
const oldNeedRepay = needRepayRecord.get(path.from);
|
|
9011
|
+
needRepayRecord.set(
|
|
9012
|
+
path.from,
|
|
9013
|
+
dex.add(
|
|
9014
|
+
txb,
|
|
9015
|
+
oldNeedRepay,
|
|
9016
|
+
flashSwapResult.repayAmount,
|
|
9017
|
+
path.publishedAt
|
|
9018
|
+
)
|
|
9019
|
+
);
|
|
9020
|
+
} else {
|
|
9021
|
+
needRepayRecord.set(path.from, flashSwapResult.repayAmount);
|
|
9022
|
+
}
|
|
9023
|
+
}
|
|
9024
|
+
for (let j = 0; j < routerData.paths.length; j++) {
|
|
9025
|
+
const path = routerData.paths[j];
|
|
9026
|
+
dex.repayFlashSwapFixedOutput(txb, path, swapCtx, receipts[j]);
|
|
9027
|
+
}
|
|
9028
|
+
const remainInputBalance = takeBalance(
|
|
9029
|
+
{
|
|
9030
|
+
coinType: processedData.fromCoinType,
|
|
9031
|
+
amount: U64_MAX,
|
|
9032
|
+
swapCtx,
|
|
9033
|
+
packages: processedData.packages
|
|
9034
|
+
},
|
|
9035
|
+
txb
|
|
9036
|
+
);
|
|
9037
|
+
transferBalance(
|
|
9038
|
+
{
|
|
9039
|
+
balance: remainInputBalance,
|
|
9040
|
+
coinType: processedData.fromCoinType,
|
|
9041
|
+
recipient: this.signer,
|
|
9042
|
+
packages: processedData.packages
|
|
9043
|
+
},
|
|
9044
|
+
txb
|
|
9045
|
+
);
|
|
9046
|
+
const outputCoin = confirmSwap(
|
|
9047
|
+
{
|
|
9048
|
+
swapContext: swapCtx,
|
|
9049
|
+
targetCoinType: processedData.targetCoinType,
|
|
9050
|
+
packages: processedData.packages
|
|
9051
|
+
},
|
|
9052
|
+
txb
|
|
9053
|
+
);
|
|
9054
|
+
return outputCoin;
|
|
9055
|
+
}
|
|
8872
9056
|
routerSwap(params) {
|
|
8873
9057
|
return __async(this, null, function* () {
|
|
8874
9058
|
const { router, inputCoin, slippage, txb, partner } = params;
|
|
@@ -8919,6 +9103,67 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
8919
9103
|
}
|
|
8920
9104
|
});
|
|
8921
9105
|
}
|
|
9106
|
+
/**
|
|
9107
|
+
* Router swap with max amount in validation.
|
|
9108
|
+
* This method validates that the input coin amount does not exceed maxAmountIn.
|
|
9109
|
+
* If the validation fails, the transaction will abort with an error.
|
|
9110
|
+
*
|
|
9111
|
+
* @param params - Router swap parameters with maxAmountIn
|
|
9112
|
+
* @returns TransactionObjectArgument - The output coin from the swap
|
|
9113
|
+
* @throws Error if input coin amount exceeds maxAmountIn
|
|
9114
|
+
*/
|
|
9115
|
+
routerSwapWithMaxAmountIn(params) {
|
|
9116
|
+
return __async(this, null, function* () {
|
|
9117
|
+
const { router, inputCoin, slippage, txb, partner, maxAmountIn } = params;
|
|
9118
|
+
if (slippage > 1 || slippage < 0) {
|
|
9119
|
+
throw new Error(CLIENT_CONFIG.ERRORS.INVALID_SLIPPAGE);
|
|
9120
|
+
}
|
|
9121
|
+
if (!params.router.packages || !params.router.packages.get(PACKAGE_NAMES.AGGREGATOR_V3)) {
|
|
9122
|
+
throw new Error(CLIENT_CONFIG.ERRORS.PACKAGES_REQUIRED);
|
|
9123
|
+
}
|
|
9124
|
+
const byAmountIn = params.router.byAmountIn;
|
|
9125
|
+
const amountIn = router.amountIn;
|
|
9126
|
+
const amountOut = router.amountOut;
|
|
9127
|
+
checkOverlayFeeConfig(this.overlayFeeRate, this.overlayFeeReceiver);
|
|
9128
|
+
let overlayFee = new import_bn6.default(0);
|
|
9129
|
+
if (byAmountIn) {
|
|
9130
|
+
overlayFee = amountOut.mul(new import_bn6.default(this.overlayFeeRate)).div(new import_bn6.default(1e6));
|
|
9131
|
+
} else {
|
|
9132
|
+
overlayFee = amountIn.mul(new import_bn6.default(this.overlayFeeRate)).div(new import_bn6.default(1e6));
|
|
9133
|
+
}
|
|
9134
|
+
const expectedAmountOut = byAmountIn ? amountOut.sub(overlayFee) : amountOut;
|
|
9135
|
+
const expectedAmountIn = byAmountIn ? amountIn : amountIn.add(overlayFee);
|
|
9136
|
+
const amountLimit = CalculateAmountLimitBN(
|
|
9137
|
+
byAmountIn ? expectedAmountOut : expectedAmountIn,
|
|
9138
|
+
byAmountIn,
|
|
9139
|
+
slippage
|
|
9140
|
+
);
|
|
9141
|
+
const priceIDs = findPythPriceIDs(router.paths);
|
|
9142
|
+
const priceInfoObjectIds = priceIDs.length > 0 ? yield this.updatePythPriceIDs(priceIDs, txb) : /* @__PURE__ */ new Map();
|
|
9143
|
+
if (byAmountIn) {
|
|
9144
|
+
return this.expectInputSwapV3WithMaxAmountIn(
|
|
9145
|
+
txb,
|
|
9146
|
+
inputCoin,
|
|
9147
|
+
router,
|
|
9148
|
+
maxAmountIn,
|
|
9149
|
+
amountOut.toString(),
|
|
9150
|
+
amountLimit.toString(),
|
|
9151
|
+
priceInfoObjectIds,
|
|
9152
|
+
partner != null ? partner : this.partner
|
|
9153
|
+
);
|
|
9154
|
+
} else {
|
|
9155
|
+
return this.expectOutputSwapV3WithMaxAmountIn(
|
|
9156
|
+
txb,
|
|
9157
|
+
inputCoin,
|
|
9158
|
+
router,
|
|
9159
|
+
maxAmountIn,
|
|
9160
|
+
amountOut.toString(),
|
|
9161
|
+
amountLimit.toString(),
|
|
9162
|
+
partner != null ? partner : this.partner
|
|
9163
|
+
);
|
|
9164
|
+
}
|
|
9165
|
+
});
|
|
9166
|
+
}
|
|
8922
9167
|
// auto build input coin
|
|
8923
9168
|
// auto merge, transfer or destory target coin.
|
|
8924
9169
|
fastRouterSwap(params) {
|
|
@@ -9139,7 +9384,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
9139
9384
|
const coinA = direction ? fromCoin : targetCoin;
|
|
9140
9385
|
const coinB = direction ? targetCoin : fromCoin;
|
|
9141
9386
|
const typeArguments = [coinA, coinB];
|
|
9142
|
-
const integratePublishedAt = this.env === 0 /* Mainnet */ ? "
|
|
9387
|
+
const integratePublishedAt = this.env === 0 /* Mainnet */ ? "0xfbb32ac0fa89a3cb0c56c745b688c6d2a53ac8e43447119ad822763997ffb9c3" : "0xab2d58dd28ff0dc19b18ab2c634397b785a38c342a8f5065ade5f53f9dbffa1c";
|
|
9143
9388
|
for (let i = 0; i < pools.length; i++) {
|
|
9144
9389
|
const args = [
|
|
9145
9390
|
tx.object(pools[i]),
|
|
@@ -9201,6 +9446,8 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
9201
9446
|
const pureAmountIn = new import_bn6.default((_b = event.amount_in) != null ? _b : 0);
|
|
9202
9447
|
const feeAmount = new import_bn6.default((_c = event.fee_amount) != null ? _c : 0);
|
|
9203
9448
|
const amountIn = pureAmountIn.add(feeAmount);
|
|
9449
|
+
const cetusRouterV3PublishedAt = this.env === 0 /* Mainnet */ ? MAINNET_CETUS_V3_PUBLISHED_AT : TESTNET_CETUS_V3_PUBLISHED_AT;
|
|
9450
|
+
const aggregatorV3PublishedAt = this.env === 0 /* Mainnet */ ? AGGREGATOR_V3_CONFIG.DEFAULT_PUBLISHED_AT.Mainnet : AGGREGATOR_V3_CONFIG.DEFAULT_PUBLISHED_AT.Testnet;
|
|
9204
9451
|
const routeData = {
|
|
9205
9452
|
amountIn,
|
|
9206
9453
|
amountOut: new import_bn6.default((_d = event.amount_out) != null ? _d : 0),
|
|
@@ -9215,7 +9462,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
9215
9462
|
feeRate,
|
|
9216
9463
|
amountIn: amountIn.toString(),
|
|
9217
9464
|
amountOut: event.amount_out,
|
|
9218
|
-
publishedAt:
|
|
9465
|
+
publishedAt: cetusRouterV3PublishedAt,
|
|
9219
9466
|
extendedDetails: {
|
|
9220
9467
|
afterSqrtPrice: event.after_sqrt_price
|
|
9221
9468
|
}
|
|
@@ -9227,7 +9474,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
9227
9474
|
packages: /* @__PURE__ */ new Map([
|
|
9228
9475
|
[
|
|
9229
9476
|
PACKAGE_NAMES.AGGREGATOR_V3,
|
|
9230
|
-
|
|
9477
|
+
aggregatorV3PublishedAt
|
|
9231
9478
|
]
|
|
9232
9479
|
])
|
|
9233
9480
|
};
|
|
@@ -9380,7 +9627,6 @@ exports.CETUSDLMM = CETUSDLMM;
|
|
|
9380
9627
|
exports.CETUS_DEX = CETUS_DEX;
|
|
9381
9628
|
exports.CETUS_MODULE = CETUS_MODULE;
|
|
9382
9629
|
exports.CETUS_PUBLISHED_AT = CETUS_PUBLISHED_AT;
|
|
9383
|
-
exports.CETUS_V3_PUBLISHED_AT = CETUS_V3_PUBLISHED_AT;
|
|
9384
9630
|
exports.CHECK_COINS_THRESHOLD_FUNC = CHECK_COINS_THRESHOLD_FUNC;
|
|
9385
9631
|
exports.CLIENT_CONFIG = CLIENT_CONFIG;
|
|
9386
9632
|
exports.CLOCK_ADDRESS = CLOCK_ADDRESS;
|
|
@@ -9439,7 +9685,7 @@ exports.MAINNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID = MAINNET_AFTERMATH_PROTOCOL_FEE
|
|
|
9439
9685
|
exports.MAINNET_AFTERMATH_REFERRAL_VAULT_ID = MAINNET_AFTERMATH_REFERRAL_VAULT_ID;
|
|
9440
9686
|
exports.MAINNET_AFTERMATH_REGISTRY_ID = MAINNET_AFTERMATH_REGISTRY_ID;
|
|
9441
9687
|
exports.MAINNET_AFTERMATH_TREASURY_ID = MAINNET_AFTERMATH_TREASURY_ID;
|
|
9442
|
-
exports.
|
|
9688
|
+
exports.MAINNET_CETUS_V3_PUBLISHED_AT = MAINNET_CETUS_V3_PUBLISHED_AT;
|
|
9443
9689
|
exports.MAINNET_FLOWX_AMM_CONTAINER_ID = MAINNET_FLOWX_AMM_CONTAINER_ID;
|
|
9444
9690
|
exports.METASTABLE = METASTABLE;
|
|
9445
9691
|
exports.MOMENTUM = MOMENTUM;
|
|
@@ -9473,7 +9719,7 @@ exports.TESTNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID = TESTNET_AFTERMATH_PROTOCOL_FEE
|
|
|
9473
9719
|
exports.TESTNET_AFTERMATH_REFERRAL_VAULT_ID = TESTNET_AFTERMATH_REFERRAL_VAULT_ID;
|
|
9474
9720
|
exports.TESTNET_AFTERMATH_REGISTRY_ID = TESTNET_AFTERMATH_REGISTRY_ID;
|
|
9475
9721
|
exports.TESTNET_AFTERMATH_TREASURY_ID = TESTNET_AFTERMATH_TREASURY_ID;
|
|
9476
|
-
exports.
|
|
9722
|
+
exports.TESTNET_CETUS_V3_PUBLISHED_AT = TESTNET_CETUS_V3_PUBLISHED_AT;
|
|
9477
9723
|
exports.TESTNET_FLOWX_AMM_CONTAINER_ID = TESTNET_FLOWX_AMM_CONTAINER_ID;
|
|
9478
9724
|
exports.TRANSFER_ACCOUNT_CAP = TRANSFER_ACCOUNT_CAP;
|
|
9479
9725
|
exports.TRANSFER_OR_DESTORY_COIN_FUNC = TRANSFER_OR_DESTORY_COIN_FUNC;
|
package/dist/index.mjs
CHANGED
|
@@ -3359,9 +3359,8 @@ var SuiZeroCoinFn = "0x2::coin::zero";
|
|
|
3359
3359
|
var DEEPBOOK_PACKAGE_ID = "0x000000000000000000000000000000000000000000000000000000000000dee9";
|
|
3360
3360
|
var DEEPBOOK_PUBLISHED_AT = "0x000000000000000000000000000000000000000000000000000000000000dee9";
|
|
3361
3361
|
var CETUS_PUBLISHED_AT = "0x70968826ad1b4ba895753f634b0aea68d0672908ca1075a2abdf0fc9e0b2fc6a";
|
|
3362
|
-
var
|
|
3363
|
-
var
|
|
3364
|
-
var TESTNET_CETUS_GLOBAL_CONFIG_ID = "0x6f4149091a5aea0e818e7243a13adcfb403842d670b9a2089de058512620687a";
|
|
3362
|
+
var MAINNET_CETUS_V3_PUBLISHED_AT = "0xd7b0cfc33a3b46c0ae0e2584c44028385da11724d4c94ec5b21a78117c5c1ab9";
|
|
3363
|
+
var TESTNET_CETUS_V3_PUBLISHED_AT = "0x7a82ed4b00a8c68d751b6c0cbd4e989691daa4716a1cf4f875c2f9b28fb72f3a";
|
|
3365
3364
|
var MAINNET_FLOWX_AMM_CONTAINER_ID = "0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511";
|
|
3366
3365
|
var TESTNET_FLOWX_AMM_CONTAINER_ID = "";
|
|
3367
3366
|
var TURBOS_VERSIONED = "0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f";
|
|
@@ -3441,13 +3440,13 @@ var AGGREGATOR_V3_CONFIG = {
|
|
|
3441
3440
|
// 10%
|
|
3442
3441
|
MAX_AMOUNT_IN: U64_MAX,
|
|
3443
3442
|
DEFAULT_PUBLISHED_AT: {
|
|
3444
|
-
Mainnet: "
|
|
3445
|
-
Testnet: "
|
|
3443
|
+
Mainnet: "0xde5d696a79714ca5cb910b9aed99d41f67353abb00715ceaeb0663d57ee39640",
|
|
3444
|
+
Testnet: "0x61da681cf2af95cb214a71596b49e662290065536984ed7e06b47e701ef547e3"
|
|
3446
3445
|
}
|
|
3447
3446
|
};
|
|
3448
3447
|
|
|
3449
3448
|
// src/api.ts
|
|
3450
|
-
var SDK_VERSION =
|
|
3449
|
+
var SDK_VERSION = 1010401;
|
|
3451
3450
|
function parseRouterResponse(data, byAmountIn) {
|
|
3452
3451
|
let packages = /* @__PURE__ */ new Map();
|
|
3453
3452
|
if (data.packages) {
|
|
@@ -6098,11 +6097,8 @@ function CalculateAmountLimitByDecimal(expectAmount, byAmountIn, slippage) {
|
|
|
6098
6097
|
}
|
|
6099
6098
|
var CetusRouter = class {
|
|
6100
6099
|
constructor(env, partner) {
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
}
|
|
6104
|
-
this.globalConfig = env === 0 /* Mainnet */ ? "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f" : "0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e";
|
|
6105
|
-
this.partner = partner != null ? partner : env === 0 /* Mainnet */ ? "0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b" : "0x1f5fa5c820f40d43fc47815ad06d95e40a1942ff72a732a92e8ef4aa8cde70a5";
|
|
6100
|
+
this.globalConfig = env === 0 /* Mainnet */ ? "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f" : "0xc6273f844b4bc258952c4e477697aa12c918c8e08106fac6b934811298c9820a";
|
|
6101
|
+
this.partner = partner != null ? partner : env === 0 /* Mainnet */ ? "0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b" : "0xfdc30896f88f74544fd507722d3bf52e46b06412ba8241ba0e854cbc65f8d85f";
|
|
6106
6102
|
}
|
|
6107
6103
|
// By amount in
|
|
6108
6104
|
swap(txb, flattenedPath, swapContext, _extends) {
|
|
@@ -7753,6 +7749,37 @@ function newSwapContext(params, txb) {
|
|
|
7753
7749
|
});
|
|
7754
7750
|
return swap_context;
|
|
7755
7751
|
}
|
|
7752
|
+
function newSwapContextV2(params, txb) {
|
|
7753
|
+
const {
|
|
7754
|
+
quoteID,
|
|
7755
|
+
fromCoinType,
|
|
7756
|
+
targetCoinType,
|
|
7757
|
+
maxAmountIn,
|
|
7758
|
+
expectAmountOut,
|
|
7759
|
+
amountOutLimit,
|
|
7760
|
+
inputCoin,
|
|
7761
|
+
feeRate,
|
|
7762
|
+
feeRecipient,
|
|
7763
|
+
aggregatorPublishedAt,
|
|
7764
|
+
packages
|
|
7765
|
+
} = params;
|
|
7766
|
+
const publishedAt = getAggregatorPublishedAt(packages, aggregatorPublishedAt);
|
|
7767
|
+
const args = [
|
|
7768
|
+
txb.pure.string(quoteID),
|
|
7769
|
+
txb.pure.u64(maxAmountIn.toString()),
|
|
7770
|
+
txb.pure.u64(expectAmountOut.toString()),
|
|
7771
|
+
txb.pure.u64(amountOutLimit.toString()),
|
|
7772
|
+
inputCoin,
|
|
7773
|
+
txb.pure.u32(Number(feeRate.toString())),
|
|
7774
|
+
txb.pure.address(feeRecipient)
|
|
7775
|
+
];
|
|
7776
|
+
const swap_context = txb.moveCall({
|
|
7777
|
+
target: `${publishedAt}::router::new_swap_context_v2`,
|
|
7778
|
+
typeArguments: [fromCoinType, targetCoinType],
|
|
7779
|
+
arguments: args
|
|
7780
|
+
});
|
|
7781
|
+
return swap_context;
|
|
7782
|
+
}
|
|
7756
7783
|
function confirmSwap(params, txb) {
|
|
7757
7784
|
const { swapContext, targetCoinType, aggregatorPublishedAt, packages } = params;
|
|
7758
7785
|
const publishedAt = getAggregatorPublishedAt(packages, aggregatorPublishedAt);
|
|
@@ -8754,6 +8781,53 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
8754
8781
|
);
|
|
8755
8782
|
return outputCoin;
|
|
8756
8783
|
}
|
|
8784
|
+
expectInputSwapV3WithMaxAmountIn(txb, inputCoin, routerData, maxAmountIn, expectAmountOut, amountOutLimit, pythPriceIDs, partner, cetusDlmmPartner) {
|
|
8785
|
+
if (routerData.quoteID == null) {
|
|
8786
|
+
throw new Error(CLIENT_CONFIG.ERRORS.QUOTE_ID_REQUIRED);
|
|
8787
|
+
}
|
|
8788
|
+
const processedData = processFlattenRoutes(routerData);
|
|
8789
|
+
const swapCtx = newSwapContextV2(
|
|
8790
|
+
{
|
|
8791
|
+
quoteID: processedData.quoteID,
|
|
8792
|
+
fromCoinType: processedData.fromCoinType,
|
|
8793
|
+
targetCoinType: processedData.targetCoinType,
|
|
8794
|
+
maxAmountIn,
|
|
8795
|
+
expectAmountOut,
|
|
8796
|
+
amountOutLimit,
|
|
8797
|
+
inputCoin,
|
|
8798
|
+
feeRate: this.overlayFeeRate,
|
|
8799
|
+
feeRecipient: this.overlayFeeReceiver,
|
|
8800
|
+
packages: processedData.packages
|
|
8801
|
+
},
|
|
8802
|
+
txb
|
|
8803
|
+
);
|
|
8804
|
+
let dexRouters = /* @__PURE__ */ new Map();
|
|
8805
|
+
for (const flattenedPath of processedData.flattenedPaths) {
|
|
8806
|
+
const path = flattenedPath.path;
|
|
8807
|
+
if (!dexRouters.has(path.provider)) {
|
|
8808
|
+
dexRouters.set(
|
|
8809
|
+
path.provider,
|
|
8810
|
+
this.newDexRouterV3(
|
|
8811
|
+
path.provider,
|
|
8812
|
+
pythPriceIDs,
|
|
8813
|
+
partner,
|
|
8814
|
+
cetusDlmmPartner
|
|
8815
|
+
)
|
|
8816
|
+
);
|
|
8817
|
+
}
|
|
8818
|
+
const dex = dexRouters.get(path.provider);
|
|
8819
|
+
dex.swap(txb, flattenedPath, swapCtx, { pythPriceIDs });
|
|
8820
|
+
}
|
|
8821
|
+
const outputCoin = confirmSwap(
|
|
8822
|
+
{
|
|
8823
|
+
swapContext: swapCtx,
|
|
8824
|
+
targetCoinType: processedData.targetCoinType,
|
|
8825
|
+
packages: processedData.packages
|
|
8826
|
+
},
|
|
8827
|
+
txb
|
|
8828
|
+
);
|
|
8829
|
+
return outputCoin;
|
|
8830
|
+
}
|
|
8757
8831
|
expectOutputSwapV3(txb, inputCoin, routerData, amountOut, _amountLimit, partner) {
|
|
8758
8832
|
const receipts = [];
|
|
8759
8833
|
const dex = new CetusRouter(this.env, partner);
|
|
@@ -8863,6 +8937,116 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
8863
8937
|
);
|
|
8864
8938
|
return outputCoin;
|
|
8865
8939
|
}
|
|
8940
|
+
expectOutputSwapV3WithMaxAmountIn(txb, inputCoin, routerData, maxAmountIn, amountOut, _amountLimit, partner) {
|
|
8941
|
+
const receipts = [];
|
|
8942
|
+
const dex = new CetusRouter(this.env, partner);
|
|
8943
|
+
const processedData = processFlattenRoutes(routerData);
|
|
8944
|
+
const swapCtx = newSwapContextV2(
|
|
8945
|
+
{
|
|
8946
|
+
quoteID: processedData.quoteID,
|
|
8947
|
+
fromCoinType: processedData.fromCoinType,
|
|
8948
|
+
targetCoinType: processedData.targetCoinType,
|
|
8949
|
+
maxAmountIn,
|
|
8950
|
+
expectAmountOut: amountOut,
|
|
8951
|
+
amountOutLimit: amountOut,
|
|
8952
|
+
// amountOutLimit equals expectAmountOut when fix amout out
|
|
8953
|
+
inputCoin,
|
|
8954
|
+
feeRate: this.overlayFeeRate,
|
|
8955
|
+
feeRecipient: this.overlayFeeReceiver,
|
|
8956
|
+
packages: processedData.packages
|
|
8957
|
+
},
|
|
8958
|
+
txb
|
|
8959
|
+
);
|
|
8960
|
+
const firstCoinRecord = recordFirstCoinIndex(routerData.paths);
|
|
8961
|
+
let needRepayRecord = /* @__PURE__ */ new Map();
|
|
8962
|
+
let payRecord = /* @__PURE__ */ new Map();
|
|
8963
|
+
for (let j = routerData.paths.length - 1; j >= 0; j--) {
|
|
8964
|
+
const path = routerData.paths[j];
|
|
8965
|
+
const firstFromTokenIndex = firstCoinRecord.get(path.from);
|
|
8966
|
+
let amountArg;
|
|
8967
|
+
if (j !== firstFromTokenIndex || path.target === processedData.targetCoinType) {
|
|
8968
|
+
if (path.target !== processedData.targetCoinType) {
|
|
8969
|
+
let payAmount = BigInt(path.amountOut);
|
|
8970
|
+
if (payRecord.has(path.target)) {
|
|
8971
|
+
const oldPayAmount = payRecord.get(path.target);
|
|
8972
|
+
payAmount = oldPayAmount + payAmount;
|
|
8973
|
+
}
|
|
8974
|
+
payRecord.set(path.target, payAmount);
|
|
8975
|
+
}
|
|
8976
|
+
amountArg = txb.pure.u64(
|
|
8977
|
+
path.amountOut.toString()
|
|
8978
|
+
);
|
|
8979
|
+
} else {
|
|
8980
|
+
if (!needRepayRecord.has(path.target)) {
|
|
8981
|
+
throw Error("no need repay record");
|
|
8982
|
+
}
|
|
8983
|
+
if (payRecord.has(path.target)) {
|
|
8984
|
+
const oldPayAmount = payRecord.get(path.target);
|
|
8985
|
+
const oldNeedRepay = needRepayRecord.get(path.target);
|
|
8986
|
+
amountArg = dex.sub(
|
|
8987
|
+
txb,
|
|
8988
|
+
oldNeedRepay,
|
|
8989
|
+
txb.pure.u64(oldPayAmount),
|
|
8990
|
+
path.publishedAt
|
|
8991
|
+
);
|
|
8992
|
+
} else {
|
|
8993
|
+
amountArg = needRepayRecord.get(path.target);
|
|
8994
|
+
}
|
|
8995
|
+
}
|
|
8996
|
+
const flashSwapResult = dex.flashSwapFixedOutput(
|
|
8997
|
+
txb,
|
|
8998
|
+
path,
|
|
8999
|
+
amountArg,
|
|
9000
|
+
swapCtx
|
|
9001
|
+
);
|
|
9002
|
+
receipts.unshift(flashSwapResult.flashReceipt);
|
|
9003
|
+
if (needRepayRecord.has(path.from)) {
|
|
9004
|
+
const oldNeedRepay = needRepayRecord.get(path.from);
|
|
9005
|
+
needRepayRecord.set(
|
|
9006
|
+
path.from,
|
|
9007
|
+
dex.add(
|
|
9008
|
+
txb,
|
|
9009
|
+
oldNeedRepay,
|
|
9010
|
+
flashSwapResult.repayAmount,
|
|
9011
|
+
path.publishedAt
|
|
9012
|
+
)
|
|
9013
|
+
);
|
|
9014
|
+
} else {
|
|
9015
|
+
needRepayRecord.set(path.from, flashSwapResult.repayAmount);
|
|
9016
|
+
}
|
|
9017
|
+
}
|
|
9018
|
+
for (let j = 0; j < routerData.paths.length; j++) {
|
|
9019
|
+
const path = routerData.paths[j];
|
|
9020
|
+
dex.repayFlashSwapFixedOutput(txb, path, swapCtx, receipts[j]);
|
|
9021
|
+
}
|
|
9022
|
+
const remainInputBalance = takeBalance(
|
|
9023
|
+
{
|
|
9024
|
+
coinType: processedData.fromCoinType,
|
|
9025
|
+
amount: U64_MAX,
|
|
9026
|
+
swapCtx,
|
|
9027
|
+
packages: processedData.packages
|
|
9028
|
+
},
|
|
9029
|
+
txb
|
|
9030
|
+
);
|
|
9031
|
+
transferBalance(
|
|
9032
|
+
{
|
|
9033
|
+
balance: remainInputBalance,
|
|
9034
|
+
coinType: processedData.fromCoinType,
|
|
9035
|
+
recipient: this.signer,
|
|
9036
|
+
packages: processedData.packages
|
|
9037
|
+
},
|
|
9038
|
+
txb
|
|
9039
|
+
);
|
|
9040
|
+
const outputCoin = confirmSwap(
|
|
9041
|
+
{
|
|
9042
|
+
swapContext: swapCtx,
|
|
9043
|
+
targetCoinType: processedData.targetCoinType,
|
|
9044
|
+
packages: processedData.packages
|
|
9045
|
+
},
|
|
9046
|
+
txb
|
|
9047
|
+
);
|
|
9048
|
+
return outputCoin;
|
|
9049
|
+
}
|
|
8866
9050
|
routerSwap(params) {
|
|
8867
9051
|
return __async(this, null, function* () {
|
|
8868
9052
|
const { router, inputCoin, slippage, txb, partner } = params;
|
|
@@ -8913,6 +9097,67 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
8913
9097
|
}
|
|
8914
9098
|
});
|
|
8915
9099
|
}
|
|
9100
|
+
/**
|
|
9101
|
+
* Router swap with max amount in validation.
|
|
9102
|
+
* This method validates that the input coin amount does not exceed maxAmountIn.
|
|
9103
|
+
* If the validation fails, the transaction will abort with an error.
|
|
9104
|
+
*
|
|
9105
|
+
* @param params - Router swap parameters with maxAmountIn
|
|
9106
|
+
* @returns TransactionObjectArgument - The output coin from the swap
|
|
9107
|
+
* @throws Error if input coin amount exceeds maxAmountIn
|
|
9108
|
+
*/
|
|
9109
|
+
routerSwapWithMaxAmountIn(params) {
|
|
9110
|
+
return __async(this, null, function* () {
|
|
9111
|
+
const { router, inputCoin, slippage, txb, partner, maxAmountIn } = params;
|
|
9112
|
+
if (slippage > 1 || slippage < 0) {
|
|
9113
|
+
throw new Error(CLIENT_CONFIG.ERRORS.INVALID_SLIPPAGE);
|
|
9114
|
+
}
|
|
9115
|
+
if (!params.router.packages || !params.router.packages.get(PACKAGE_NAMES.AGGREGATOR_V3)) {
|
|
9116
|
+
throw new Error(CLIENT_CONFIG.ERRORS.PACKAGES_REQUIRED);
|
|
9117
|
+
}
|
|
9118
|
+
const byAmountIn = params.router.byAmountIn;
|
|
9119
|
+
const amountIn = router.amountIn;
|
|
9120
|
+
const amountOut = router.amountOut;
|
|
9121
|
+
checkOverlayFeeConfig(this.overlayFeeRate, this.overlayFeeReceiver);
|
|
9122
|
+
let overlayFee = new import_bn6.default(0);
|
|
9123
|
+
if (byAmountIn) {
|
|
9124
|
+
overlayFee = amountOut.mul(new import_bn6.default(this.overlayFeeRate)).div(new import_bn6.default(1e6));
|
|
9125
|
+
} else {
|
|
9126
|
+
overlayFee = amountIn.mul(new import_bn6.default(this.overlayFeeRate)).div(new import_bn6.default(1e6));
|
|
9127
|
+
}
|
|
9128
|
+
const expectedAmountOut = byAmountIn ? amountOut.sub(overlayFee) : amountOut;
|
|
9129
|
+
const expectedAmountIn = byAmountIn ? amountIn : amountIn.add(overlayFee);
|
|
9130
|
+
const amountLimit = CalculateAmountLimitBN(
|
|
9131
|
+
byAmountIn ? expectedAmountOut : expectedAmountIn,
|
|
9132
|
+
byAmountIn,
|
|
9133
|
+
slippage
|
|
9134
|
+
);
|
|
9135
|
+
const priceIDs = findPythPriceIDs(router.paths);
|
|
9136
|
+
const priceInfoObjectIds = priceIDs.length > 0 ? yield this.updatePythPriceIDs(priceIDs, txb) : /* @__PURE__ */ new Map();
|
|
9137
|
+
if (byAmountIn) {
|
|
9138
|
+
return this.expectInputSwapV3WithMaxAmountIn(
|
|
9139
|
+
txb,
|
|
9140
|
+
inputCoin,
|
|
9141
|
+
router,
|
|
9142
|
+
maxAmountIn,
|
|
9143
|
+
amountOut.toString(),
|
|
9144
|
+
amountLimit.toString(),
|
|
9145
|
+
priceInfoObjectIds,
|
|
9146
|
+
partner != null ? partner : this.partner
|
|
9147
|
+
);
|
|
9148
|
+
} else {
|
|
9149
|
+
return this.expectOutputSwapV3WithMaxAmountIn(
|
|
9150
|
+
txb,
|
|
9151
|
+
inputCoin,
|
|
9152
|
+
router,
|
|
9153
|
+
maxAmountIn,
|
|
9154
|
+
amountOut.toString(),
|
|
9155
|
+
amountLimit.toString(),
|
|
9156
|
+
partner != null ? partner : this.partner
|
|
9157
|
+
);
|
|
9158
|
+
}
|
|
9159
|
+
});
|
|
9160
|
+
}
|
|
8916
9161
|
// auto build input coin
|
|
8917
9162
|
// auto merge, transfer or destory target coin.
|
|
8918
9163
|
fastRouterSwap(params) {
|
|
@@ -9133,7 +9378,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
9133
9378
|
const coinA = direction ? fromCoin : targetCoin;
|
|
9134
9379
|
const coinB = direction ? targetCoin : fromCoin;
|
|
9135
9380
|
const typeArguments = [coinA, coinB];
|
|
9136
|
-
const integratePublishedAt = this.env === 0 /* Mainnet */ ? "
|
|
9381
|
+
const integratePublishedAt = this.env === 0 /* Mainnet */ ? "0xfbb32ac0fa89a3cb0c56c745b688c6d2a53ac8e43447119ad822763997ffb9c3" : "0xab2d58dd28ff0dc19b18ab2c634397b785a38c342a8f5065ade5f53f9dbffa1c";
|
|
9137
9382
|
for (let i = 0; i < pools.length; i++) {
|
|
9138
9383
|
const args = [
|
|
9139
9384
|
tx.object(pools[i]),
|
|
@@ -9195,6 +9440,8 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
9195
9440
|
const pureAmountIn = new import_bn6.default((_b = event.amount_in) != null ? _b : 0);
|
|
9196
9441
|
const feeAmount = new import_bn6.default((_c = event.fee_amount) != null ? _c : 0);
|
|
9197
9442
|
const amountIn = pureAmountIn.add(feeAmount);
|
|
9443
|
+
const cetusRouterV3PublishedAt = this.env === 0 /* Mainnet */ ? MAINNET_CETUS_V3_PUBLISHED_AT : TESTNET_CETUS_V3_PUBLISHED_AT;
|
|
9444
|
+
const aggregatorV3PublishedAt = this.env === 0 /* Mainnet */ ? AGGREGATOR_V3_CONFIG.DEFAULT_PUBLISHED_AT.Mainnet : AGGREGATOR_V3_CONFIG.DEFAULT_PUBLISHED_AT.Testnet;
|
|
9198
9445
|
const routeData = {
|
|
9199
9446
|
amountIn,
|
|
9200
9447
|
amountOut: new import_bn6.default((_d = event.amount_out) != null ? _d : 0),
|
|
@@ -9209,7 +9456,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
9209
9456
|
feeRate,
|
|
9210
9457
|
amountIn: amountIn.toString(),
|
|
9211
9458
|
amountOut: event.amount_out,
|
|
9212
|
-
publishedAt:
|
|
9459
|
+
publishedAt: cetusRouterV3PublishedAt,
|
|
9213
9460
|
extendedDetails: {
|
|
9214
9461
|
afterSqrtPrice: event.after_sqrt_price
|
|
9215
9462
|
}
|
|
@@ -9221,7 +9468,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
9221
9468
|
packages: /* @__PURE__ */ new Map([
|
|
9222
9469
|
[
|
|
9223
9470
|
PACKAGE_NAMES.AGGREGATOR_V3,
|
|
9224
|
-
|
|
9471
|
+
aggregatorV3PublishedAt
|
|
9225
9472
|
]
|
|
9226
9473
|
])
|
|
9227
9474
|
};
|
|
@@ -9355,4 +9602,4 @@ decimal.js/decimal.mjs:
|
|
|
9355
9602
|
*)
|
|
9356
9603
|
*/
|
|
9357
9604
|
|
|
9358
|
-
export { AFSUI, AFTERMATH, AFTERMATH_AMM, AFTERMATH_MODULE, AGGREGATOR, AGGREGATOR_V3_CONFIG, ALL_DEXES, ALPHAFI, AggregatorClient, AggregatorConfig, AggregatorError, AggregatorServerErrorCode, BLUEFIN, BLUEMOVE, CETUS, CETUSDLMM, CETUS_DEX, CETUS_MODULE, CETUS_PUBLISHED_AT,
|
|
9605
|
+
export { AFSUI, AFTERMATH, AFTERMATH_AMM, AFTERMATH_MODULE, AGGREGATOR, AGGREGATOR_V3_CONFIG, ALL_DEXES, ALPHAFI, AggregatorClient, AggregatorConfig, AggregatorError, AggregatorServerErrorCode, BLUEFIN, BLUEMOVE, CETUS, CETUSDLMM, CETUS_DEX, CETUS_MODULE, CETUS_PUBLISHED_AT, CHECK_COINS_THRESHOLD_FUNC, CLIENT_CONFIG, CLOCK_ADDRESS, CoinInfoAddress, CoinStoreAddress, CoinUtils, ConfigErrorCode, DEEPBOOKV2, DEEPBOOKV3, DEEPBOOK_CLOB_V2_MODULE, DEEPBOOK_CUSTODIAN_V2_MODULE, DEEPBOOK_DEX, DEEPBOOK_MODULE, DEEPBOOK_PACKAGE_ID, DEEPBOOK_PUBLISHED_AT, DEEPBOOK_V3_DEEP_FEE_TYPES, DEFAULT_AGG_V2_ENDPOINT, DEFAULT_AGG_V3_ENDPOINT, DEFAULT_ENDPOINT, DEFAULT_GAS_BUDGET_FOR_MERGE, DEFAULT_GAS_BUDGET_FOR_SPLIT, DEFAULT_GAS_BUDGET_FOR_STAKE, DEFAULT_GAS_BUDGET_FOR_TRANSFER, DEFAULT_GAS_BUDGET_FOR_TRANSFER_SUI, DEFAULT_NFT_TRANSFER_GAS_FEE, Env, FERRACLMM, FERRADLMM, FLOWXV2, FLOWXV3, FLOWX_AMM, FLOWX_AMM_MODULE, FULLSAIL, FlashSwapA2BFunc, FlashSwapB2AFunc, FlashSwapFunc, FlashSwapWithPartnerA2BFunc, FlashSwapWithPartnerB2AFunc, FlashSwapWithPartnerFunc, GAS_SYMBOL, GAS_TYPE_ARG, GAS_TYPE_ARG_LONG, HAEDAL, HAEDALHMMV2, HAEDALPMM, HAWAL, INTEGRATE, JOIN_FUNC, KRIYA, KRIYAV3, KRIYA_DEX, KRIYA_MODULE, MAGMA, MAINNET_AFTERMATH_INSURANCE_FUND_ID, MAINNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID, MAINNET_AFTERMATH_REFERRAL_VAULT_ID, MAINNET_AFTERMATH_REGISTRY_ID, MAINNET_AFTERMATH_TREASURY_ID, MAINNET_CETUS_V3_PUBLISHED_AT, MAINNET_FLOWX_AMM_CONTAINER_ID, METASTABLE, MOMENTUM, OBRIC, ONE, PACKAGE_NAMES, PAY_MODULE, POOL_MODULT, PUBLISHED_ADDRESSES, PYTH_CONFIG, REPAY_FLASH_SWAP_A2B_FUNC, REPAY_FLASH_SWAP_B2A_FUNC, REPAY_FLASH_SWAP_WITH_PARTNER_A2B_FUNC, REPAY_FLASH_SWAP_WITH_PARTNER_B2A_FUNC, RepayFalshSwapFunc, RepayFlashSwapWithPartnerFunc, SCALLOP, SEVENK, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, SUI_SYSTEM_STATE_OBJECT_ID, SWAP_A2B_FUNC, SWAP_B2A_FUNC, SuiZeroCoinFn, TEN_POW_NINE, TESTNET_AFTERMATH_INSURANCE_FUND_ID, TESTNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID, TESTNET_AFTERMATH_REFERRAL_VAULT_ID, TESTNET_AFTERMATH_REGISTRY_ID, TESTNET_AFTERMATH_TREASURY_ID, TESTNET_CETUS_V3_PUBLISHED_AT, TESTNET_FLOWX_AMM_CONTAINER_ID, TRANSFER_ACCOUNT_CAP, TRANSFER_OR_DESTORY_COIN_FUNC, TURBOS, TURBOS_DEX, TURBOS_MODULE, TURBOS_VERSIONED, TWO, TransactionErrorCode, TypesErrorCode, U128, U64_MAX, U64_MAX_BN, UTILS_MODULE, VOLO, ZERO, buildInputCoin, calculateGasEfficiency, calculatePriceImpact, checkInvalidSuiAddress, compareCoins, compareGasMetrics, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, exportToCSV, exportToJSON, extractAddressFromType, extractGasMetrics, extractStructTagFromType, extractTimestampFromDowngradeUuid6, fixSuiObjectId, formatGasMetrics, generateDowngradeUuid6, generateSimpleDowngradeUuid6, getAggregatorServerErrorMessage, getAggregatorV2Extend2PublishedAt, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getAllProviders, getDeepbookV3Config, getDefaultSuiInputType, getMergeSwapResult, getOrCreateAccountCap, getProvidersExcluding, getProvidersIncluding, getRouterResult, isSortedSymbols, isValidDowngradeUuid6, mintZeroCoin, normalizeCoinType, parseAftermathFeeType, parseTurbosPoolFeeType, patchFixSuiObjectId, printTransaction, processEndpoint, processFlattenRoutes, restituteMsafeFastRouterSwapParams };
|