@aspan/sdk 0.2.1 → 0.2.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 +27 -43
- package/dist/index.d.mts +252 -248
- package/dist/index.d.ts +252 -248
- package/dist/index.js +144 -258
- package/dist/index.mjs +143 -258
- package/package.json +1 -1
- package/src/__tests__/router.test.ts +378 -0
- package/src/abi/router.ts +123 -202
- package/src/index.ts +3 -2
- package/src/router.ts +7 -91
- package/src/types.ts +27 -11
package/src/abi/router.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AspanRouter ABI
|
|
3
3
|
* Periphery contract for one-click swap+mint operations
|
|
4
|
+
* Updated: 2025-01-31
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
7
|
export const RouterABI = [
|
|
7
|
-
// ============ Core Functions ============
|
|
8
|
+
// ============ Core Swap+Mint Functions ============
|
|
8
9
|
|
|
9
10
|
// swapAndMintApUSD
|
|
10
11
|
{
|
|
@@ -20,14 +21,12 @@ export const RouterABI = [
|
|
|
20
21
|
{ name: "targetLST", type: "address" },
|
|
21
22
|
{ name: "minLSTOut", type: "uint256" },
|
|
22
23
|
{ name: "poolFee", type: "uint24" },
|
|
23
|
-
{ name: "useV2", type: "bool" },
|
|
24
24
|
],
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
name: "mintParams",
|
|
28
28
|
type: "tuple",
|
|
29
29
|
components: [
|
|
30
|
-
{ name: "mintXBNB", type: "bool" },
|
|
31
30
|
{ name: "minMintOut", type: "uint256" },
|
|
32
31
|
{ name: "recipient", type: "address" },
|
|
33
32
|
{ name: "deadline", type: "uint256" },
|
|
@@ -55,14 +54,12 @@ export const RouterABI = [
|
|
|
55
54
|
{ name: "targetLST", type: "address" },
|
|
56
55
|
{ name: "minLSTOut", type: "uint256" },
|
|
57
56
|
{ name: "poolFee", type: "uint24" },
|
|
58
|
-
{ name: "useV2", type: "bool" },
|
|
59
57
|
],
|
|
60
58
|
},
|
|
61
59
|
{
|
|
62
60
|
name: "mintParams",
|
|
63
61
|
type: "tuple",
|
|
64
62
|
components: [
|
|
65
|
-
{ name: "mintXBNB", type: "bool" },
|
|
66
63
|
{ name: "minMintOut", type: "uint256" },
|
|
67
64
|
{ name: "recipient", type: "address" },
|
|
68
65
|
{ name: "deadline", type: "uint256" },
|
|
@@ -76,6 +73,8 @@ export const RouterABI = [
|
|
|
76
73
|
stateMutability: "payable",
|
|
77
74
|
},
|
|
78
75
|
|
|
76
|
+
// ============ Stake+Mint Functions ============
|
|
77
|
+
|
|
79
78
|
// stakeAndMint
|
|
80
79
|
{
|
|
81
80
|
type: "function",
|
|
@@ -93,7 +92,25 @@ export const RouterABI = [
|
|
|
93
92
|
stateMutability: "payable",
|
|
94
93
|
},
|
|
95
94
|
|
|
96
|
-
//
|
|
95
|
+
// stakeAndMintApUSD (simplified)
|
|
96
|
+
{
|
|
97
|
+
type: "function",
|
|
98
|
+
name: "stakeAndMintApUSD",
|
|
99
|
+
inputs: [{ name: "minMintOut", type: "uint256" }],
|
|
100
|
+
outputs: [{ name: "apUSDAmount", type: "uint256" }],
|
|
101
|
+
stateMutability: "payable",
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
// stakeAndMintXBNB (simplified)
|
|
105
|
+
{
|
|
106
|
+
type: "function",
|
|
107
|
+
name: "stakeAndMintXBNB",
|
|
108
|
+
inputs: [{ name: "minMintOut", type: "uint256" }],
|
|
109
|
+
outputs: [{ name: "xBNBAmount", type: "uint256" }],
|
|
110
|
+
stateMutability: "payable",
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
// ============ Simplified Swap+Mint Functions ============
|
|
97
114
|
|
|
98
115
|
// swapAndMintApUSDDefault
|
|
99
116
|
{
|
|
@@ -123,24 +140,6 @@ export const RouterABI = [
|
|
|
123
140
|
stateMutability: "payable",
|
|
124
141
|
},
|
|
125
142
|
|
|
126
|
-
// stakeAndMintApUSD
|
|
127
|
-
{
|
|
128
|
-
type: "function",
|
|
129
|
-
name: "stakeAndMintApUSD",
|
|
130
|
-
inputs: [{ name: "minMintOut", type: "uint256" }],
|
|
131
|
-
outputs: [{ name: "apUSDAmount", type: "uint256" }],
|
|
132
|
-
stateMutability: "payable",
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
// stakeAndMintXBNB
|
|
136
|
-
{
|
|
137
|
-
type: "function",
|
|
138
|
-
name: "stakeAndMintXBNB",
|
|
139
|
-
inputs: [{ name: "minMintOut", type: "uint256" }],
|
|
140
|
-
outputs: [{ name: "xBNBAmount", type: "uint256" }],
|
|
141
|
-
stateMutability: "payable",
|
|
142
|
-
},
|
|
143
|
-
|
|
144
143
|
// ============ Direct Mint/Redeem Functions ============
|
|
145
144
|
|
|
146
145
|
// mintApUSD
|
|
@@ -195,7 +194,7 @@ export const RouterABI = [
|
|
|
195
194
|
stateMutability: "nonpayable",
|
|
196
195
|
},
|
|
197
196
|
|
|
198
|
-
// ============ Redeem
|
|
197
|
+
// ============ Redeem + Swap Functions (V3 path) ============
|
|
199
198
|
|
|
200
199
|
// redeemApUSDAndSwap
|
|
201
200
|
{
|
|
@@ -204,11 +203,9 @@ export const RouterABI = [
|
|
|
204
203
|
inputs: [
|
|
205
204
|
{ name: "lst", type: "address" },
|
|
206
205
|
{ name: "apUSDAmount", type: "uint256" },
|
|
207
|
-
{ name: "
|
|
206
|
+
{ name: "path", type: "bytes" },
|
|
208
207
|
{ name: "minOut", type: "uint256" },
|
|
209
208
|
{ name: "deadline", type: "uint256" },
|
|
210
|
-
{ name: "useV2", type: "bool" },
|
|
211
|
-
{ name: "poolFee", type: "uint24" },
|
|
212
209
|
],
|
|
213
210
|
outputs: [{ name: "outputAmount", type: "uint256" }],
|
|
214
211
|
stateMutability: "nonpayable",
|
|
@@ -221,44 +218,14 @@ export const RouterABI = [
|
|
|
221
218
|
inputs: [
|
|
222
219
|
{ name: "lst", type: "address" },
|
|
223
220
|
{ name: "xBNBAmount", type: "uint256" },
|
|
224
|
-
{ name: "
|
|
221
|
+
{ name: "path", type: "bytes" },
|
|
225
222
|
{ name: "minOut", type: "uint256" },
|
|
226
223
|
{ name: "deadline", type: "uint256" },
|
|
227
|
-
{ name: "useV2", type: "bool" },
|
|
228
|
-
{ name: "poolFee", type: "uint24" },
|
|
229
224
|
],
|
|
230
225
|
outputs: [{ name: "outputAmount", type: "uint256" }],
|
|
231
226
|
stateMutability: "nonpayable",
|
|
232
227
|
},
|
|
233
228
|
|
|
234
|
-
// redeemApUSDAndUnstake
|
|
235
|
-
{
|
|
236
|
-
type: "function",
|
|
237
|
-
name: "redeemApUSDAndUnstake",
|
|
238
|
-
inputs: [
|
|
239
|
-
{ name: "lst", type: "address" },
|
|
240
|
-
{ name: "apUSDAmount", type: "uint256" },
|
|
241
|
-
{ name: "minBNBOut", type: "uint256" },
|
|
242
|
-
{ name: "deadline", type: "uint256" },
|
|
243
|
-
],
|
|
244
|
-
outputs: [{ name: "bnbAmount", type: "uint256" }],
|
|
245
|
-
stateMutability: "nonpayable",
|
|
246
|
-
},
|
|
247
|
-
|
|
248
|
-
// redeemXBNBAndUnstake
|
|
249
|
-
{
|
|
250
|
-
type: "function",
|
|
251
|
-
name: "redeemXBNBAndUnstake",
|
|
252
|
-
inputs: [
|
|
253
|
-
{ name: "lst", type: "address" },
|
|
254
|
-
{ name: "xBNBAmount", type: "uint256" },
|
|
255
|
-
{ name: "minBNBOut", type: "uint256" },
|
|
256
|
-
{ name: "deadline", type: "uint256" },
|
|
257
|
-
],
|
|
258
|
-
outputs: [{ name: "bnbAmount", type: "uint256" }],
|
|
259
|
-
stateMutability: "nonpayable",
|
|
260
|
-
},
|
|
261
|
-
|
|
262
229
|
// ============ Native Unstake Functions ============
|
|
263
230
|
|
|
264
231
|
// redeemApUSDAndRequestUnstake
|
|
@@ -296,77 +263,41 @@ export const RouterABI = [
|
|
|
296
263
|
|
|
297
264
|
// ============ View Functions ============
|
|
298
265
|
|
|
299
|
-
//
|
|
300
|
-
{
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
},
|
|
266
|
+
// Token addresses
|
|
267
|
+
{ type: "function", name: "wbnb", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
|
|
268
|
+
{ type: "function", name: "usdt", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
|
|
269
|
+
{ type: "function", name: "usdc", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
|
|
270
|
+
{ type: "function", name: "slisBNB", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
|
|
271
|
+
{ type: "function", name: "asBNB", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
|
|
272
|
+
{ type: "function", name: "wclisBNB", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
|
|
273
|
+
{ type: "function", name: "apUSD", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
|
|
274
|
+
{ type: "function", name: "xBNB", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
|
|
307
275
|
|
|
308
|
-
//
|
|
276
|
+
// Protocol addresses
|
|
277
|
+
{ type: "function", name: "diamond", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
|
|
278
|
+
{ type: "function", name: "pancakeV3Router", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
|
|
279
|
+
{ type: "function", name: "listaStakeManager", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
|
|
280
|
+
{ type: "function", name: "astherusMinter", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
|
|
281
|
+
{ type: "function", name: "slisBNBProvider", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
|
|
282
|
+
|
|
283
|
+
// Configuration
|
|
284
|
+
{ type: "function", name: "defaultLST", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
|
|
309
285
|
{
|
|
310
286
|
type: "function",
|
|
311
287
|
name: "supportedInputTokens",
|
|
312
288
|
inputs: [{ name: "token", type: "address" }],
|
|
313
|
-
outputs: [{
|
|
289
|
+
outputs: [{ type: "bool" }],
|
|
314
290
|
stateMutability: "view",
|
|
315
291
|
},
|
|
316
|
-
|
|
317
|
-
// supportedLSTs
|
|
318
292
|
{
|
|
319
293
|
type: "function",
|
|
320
294
|
name: "supportedLSTs",
|
|
321
295
|
inputs: [{ name: "lst", type: "address" }],
|
|
322
|
-
outputs: [{
|
|
296
|
+
outputs: [{ type: "bool" }],
|
|
323
297
|
stateMutability: "view",
|
|
324
298
|
},
|
|
325
299
|
|
|
326
|
-
//
|
|
327
|
-
{
|
|
328
|
-
type: "function",
|
|
329
|
-
name: "diamond",
|
|
330
|
-
inputs: [],
|
|
331
|
-
outputs: [{ name: "", type: "address" }],
|
|
332
|
-
stateMutability: "view",
|
|
333
|
-
},
|
|
334
|
-
|
|
335
|
-
// getExpectedMintOutput
|
|
336
|
-
{
|
|
337
|
-
type: "function",
|
|
338
|
-
name: "getExpectedMintOutput",
|
|
339
|
-
inputs: [
|
|
340
|
-
{ name: "inputToken", type: "address" },
|
|
341
|
-
{ name: "inputAmount", type: "uint256" },
|
|
342
|
-
{ name: "targetLST", type: "address" },
|
|
343
|
-
{ name: "isXBNB", type: "bool" },
|
|
344
|
-
],
|
|
345
|
-
outputs: [
|
|
346
|
-
{ name: "expectedLST", type: "uint256" },
|
|
347
|
-
{ name: "expectedMint", type: "uint256" },
|
|
348
|
-
],
|
|
349
|
-
stateMutability: "view",
|
|
350
|
-
},
|
|
351
|
-
|
|
352
|
-
// getExpectedRedeemOutput
|
|
353
|
-
{
|
|
354
|
-
type: "function",
|
|
355
|
-
name: "getExpectedRedeemOutput",
|
|
356
|
-
inputs: [
|
|
357
|
-
{ name: "isXBNB", type: "bool" },
|
|
358
|
-
{ name: "redeemAmount", type: "uint256" },
|
|
359
|
-
{ name: "lst", type: "address" },
|
|
360
|
-
{ name: "outputToken", type: "address" },
|
|
361
|
-
],
|
|
362
|
-
outputs: [
|
|
363
|
-
{ name: "expectedLST", type: "uint256" },
|
|
364
|
-
{ name: "expectedOutput", type: "uint256" },
|
|
365
|
-
],
|
|
366
|
-
stateMutability: "view",
|
|
367
|
-
},
|
|
368
|
-
|
|
369
|
-
// previewMintApUSD
|
|
300
|
+
// Preview functions
|
|
370
301
|
{
|
|
371
302
|
type: "function",
|
|
372
303
|
name: "previewMintApUSD",
|
|
@@ -377,8 +308,6 @@ export const RouterABI = [
|
|
|
377
308
|
outputs: [{ name: "apUSDAmount", type: "uint256" }],
|
|
378
309
|
stateMutability: "view",
|
|
379
310
|
},
|
|
380
|
-
|
|
381
|
-
// previewMintXBNB
|
|
382
311
|
{
|
|
383
312
|
type: "function",
|
|
384
313
|
name: "previewMintXBNB",
|
|
@@ -389,8 +318,6 @@ export const RouterABI = [
|
|
|
389
318
|
outputs: [{ name: "xBNBAmount", type: "uint256" }],
|
|
390
319
|
stateMutability: "view",
|
|
391
320
|
},
|
|
392
|
-
|
|
393
|
-
// previewRedeemApUSD
|
|
394
321
|
{
|
|
395
322
|
type: "function",
|
|
396
323
|
name: "previewRedeemApUSD",
|
|
@@ -401,8 +328,6 @@ export const RouterABI = [
|
|
|
401
328
|
outputs: [{ name: "lstAmount", type: "uint256" }],
|
|
402
329
|
stateMutability: "view",
|
|
403
330
|
},
|
|
404
|
-
|
|
405
|
-
// previewRedeemXBNB
|
|
406
331
|
{
|
|
407
332
|
type: "function",
|
|
408
333
|
name: "previewRedeemXBNB",
|
|
@@ -414,16 +339,14 @@ export const RouterABI = [
|
|
|
414
339
|
stateMutability: "view",
|
|
415
340
|
},
|
|
416
341
|
|
|
417
|
-
//
|
|
342
|
+
// Withdrawal tracking
|
|
418
343
|
{
|
|
419
344
|
type: "function",
|
|
420
345
|
name: "getUserWithdrawalIndices",
|
|
421
346
|
inputs: [{ name: "user", type: "address" }],
|
|
422
|
-
outputs: [{
|
|
347
|
+
outputs: [{ type: "uint256[]" }],
|
|
423
348
|
stateMutability: "view",
|
|
424
349
|
},
|
|
425
|
-
|
|
426
|
-
// getWithdrawalStatus
|
|
427
350
|
{
|
|
428
351
|
type: "function",
|
|
429
352
|
name: "getWithdrawalStatus",
|
|
@@ -434,123 +357,111 @@ export const RouterABI = [
|
|
|
434
357
|
],
|
|
435
358
|
stateMutability: "view",
|
|
436
359
|
},
|
|
437
|
-
|
|
438
|
-
// Immutable addresses
|
|
439
|
-
{
|
|
440
|
-
type: "function",
|
|
441
|
-
name: "wbnb",
|
|
442
|
-
inputs: [],
|
|
443
|
-
outputs: [{ name: "", type: "address" }],
|
|
444
|
-
stateMutability: "view",
|
|
445
|
-
},
|
|
446
|
-
{
|
|
447
|
-
type: "function",
|
|
448
|
-
name: "usdt",
|
|
449
|
-
inputs: [],
|
|
450
|
-
outputs: [{ name: "", type: "address" }],
|
|
451
|
-
stateMutability: "view",
|
|
452
|
-
},
|
|
453
360
|
{
|
|
454
361
|
type: "function",
|
|
455
|
-
name: "
|
|
456
|
-
inputs: [],
|
|
457
|
-
outputs: [
|
|
362
|
+
name: "withdrawalRequests",
|
|
363
|
+
inputs: [{ name: "index", type: "uint256" }],
|
|
364
|
+
outputs: [
|
|
365
|
+
{ name: "user", type: "address" },
|
|
366
|
+
{ name: "listaIdx", type: "uint256" },
|
|
367
|
+
{ name: "slisBNBAmount", type: "uint256" },
|
|
368
|
+
{ name: "claimed", type: "bool" },
|
|
369
|
+
],
|
|
458
370
|
stateMutability: "view",
|
|
459
371
|
},
|
|
372
|
+
|
|
373
|
+
// ============ Admin Functions ============
|
|
374
|
+
|
|
375
|
+
{ type: "function", name: "owner", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
|
|
460
376
|
{
|
|
461
377
|
type: "function",
|
|
462
|
-
name: "
|
|
463
|
-
inputs: [],
|
|
464
|
-
outputs: [
|
|
465
|
-
stateMutability: "
|
|
378
|
+
name: "setDefaultLST",
|
|
379
|
+
inputs: [{ name: "lst", type: "address" }],
|
|
380
|
+
outputs: [],
|
|
381
|
+
stateMutability: "nonpayable",
|
|
466
382
|
},
|
|
467
383
|
{
|
|
468
384
|
type: "function",
|
|
469
|
-
name: "
|
|
470
|
-
inputs: [],
|
|
471
|
-
outputs: [
|
|
472
|
-
stateMutability: "
|
|
385
|
+
name: "addSupportedInputToken",
|
|
386
|
+
inputs: [{ name: "token", type: "address" }],
|
|
387
|
+
outputs: [],
|
|
388
|
+
stateMutability: "nonpayable",
|
|
473
389
|
},
|
|
474
390
|
{
|
|
475
391
|
type: "function",
|
|
476
|
-
name: "
|
|
477
|
-
inputs: [],
|
|
478
|
-
outputs: [
|
|
479
|
-
stateMutability: "
|
|
392
|
+
name: "addSupportedLST",
|
|
393
|
+
inputs: [{ name: "lst", type: "address" }],
|
|
394
|
+
outputs: [],
|
|
395
|
+
stateMutability: "nonpayable",
|
|
480
396
|
},
|
|
481
397
|
{
|
|
482
398
|
type: "function",
|
|
483
|
-
name: "
|
|
484
|
-
inputs: [
|
|
485
|
-
|
|
486
|
-
|
|
399
|
+
name: "rescueTokens",
|
|
400
|
+
inputs: [
|
|
401
|
+
{ name: "token", type: "address" },
|
|
402
|
+
{ name: "amount", type: "uint256" },
|
|
403
|
+
],
|
|
404
|
+
outputs: [],
|
|
405
|
+
stateMutability: "nonpayable",
|
|
487
406
|
},
|
|
488
407
|
{
|
|
489
408
|
type: "function",
|
|
490
|
-
name: "
|
|
491
|
-
inputs: [],
|
|
492
|
-
outputs: [
|
|
493
|
-
stateMutability: "
|
|
409
|
+
name: "transferOwnership",
|
|
410
|
+
inputs: [{ name: "newOwner", type: "address" }],
|
|
411
|
+
outputs: [],
|
|
412
|
+
stateMutability: "nonpayable",
|
|
494
413
|
},
|
|
414
|
+
{ type: "function", name: "renounceOwnership", inputs: [], outputs: [], stateMutability: "nonpayable" },
|
|
495
415
|
|
|
496
416
|
// ============ Events ============
|
|
497
417
|
|
|
498
|
-
// SwapAndMint
|
|
499
418
|
{
|
|
500
419
|
type: "event",
|
|
501
420
|
name: "SwapAndMint",
|
|
502
421
|
inputs: [
|
|
503
422
|
{ name: "user", type: "address", indexed: true },
|
|
504
|
-
{ name: "inputToken", type: "address", indexed:
|
|
423
|
+
{ name: "inputToken", type: "address", indexed: false },
|
|
505
424
|
{ name: "inputAmount", type: "uint256", indexed: false },
|
|
506
|
-
{ name: "
|
|
425
|
+
{ name: "lst", type: "address", indexed: false },
|
|
507
426
|
{ name: "lstAmount", type: "uint256", indexed: false },
|
|
508
427
|
{ name: "mintedToken", type: "address", indexed: false },
|
|
509
428
|
{ name: "mintedAmount", type: "uint256", indexed: false },
|
|
510
429
|
],
|
|
511
430
|
},
|
|
512
|
-
|
|
513
|
-
// StakeAndMint
|
|
514
431
|
{
|
|
515
432
|
type: "event",
|
|
516
433
|
name: "StakeAndMint",
|
|
517
434
|
inputs: [
|
|
518
435
|
{ name: "user", type: "address", indexed: true },
|
|
519
436
|
{ name: "bnbAmount", type: "uint256", indexed: false },
|
|
520
|
-
{ name: "
|
|
437
|
+
{ name: "lst", type: "address", indexed: false },
|
|
521
438
|
{ name: "lstAmount", type: "uint256", indexed: false },
|
|
522
|
-
{ name: "mintedToken", type: "address", indexed:
|
|
439
|
+
{ name: "mintedToken", type: "address", indexed: false },
|
|
523
440
|
{ name: "mintedAmount", type: "uint256", indexed: false },
|
|
524
441
|
],
|
|
525
442
|
},
|
|
526
|
-
|
|
527
|
-
// Mint
|
|
528
443
|
{
|
|
529
444
|
type: "event",
|
|
530
445
|
name: "Mint",
|
|
531
446
|
inputs: [
|
|
532
447
|
{ name: "user", type: "address", indexed: true },
|
|
533
|
-
{ name: "lst", type: "address", indexed:
|
|
448
|
+
{ name: "lst", type: "address", indexed: false },
|
|
534
449
|
{ name: "lstAmount", type: "uint256", indexed: false },
|
|
535
|
-
{ name: "mintedToken", type: "address", indexed:
|
|
450
|
+
{ name: "mintedToken", type: "address", indexed: false },
|
|
536
451
|
{ name: "mintedAmount", type: "uint256", indexed: false },
|
|
537
452
|
],
|
|
538
453
|
},
|
|
539
|
-
|
|
540
|
-
// Redeem
|
|
541
454
|
{
|
|
542
455
|
type: "event",
|
|
543
456
|
name: "Redeem",
|
|
544
457
|
inputs: [
|
|
545
458
|
{ name: "user", type: "address", indexed: true },
|
|
546
|
-
{ name: "redeemedToken", type: "address", indexed:
|
|
459
|
+
{ name: "redeemedToken", type: "address", indexed: false },
|
|
547
460
|
{ name: "redeemedAmount", type: "uint256", indexed: false },
|
|
548
|
-
{ name: "lst", type: "address", indexed:
|
|
461
|
+
{ name: "lst", type: "address", indexed: false },
|
|
549
462
|
{ name: "lstAmount", type: "uint256", indexed: false },
|
|
550
463
|
],
|
|
551
464
|
},
|
|
552
|
-
|
|
553
|
-
// RedeemAndSwap
|
|
554
465
|
{
|
|
555
466
|
type: "event",
|
|
556
467
|
name: "RedeemAndSwap",
|
|
@@ -560,60 +471,70 @@ export const RouterABI = [
|
|
|
560
471
|
{ name: "redeemedAmount", type: "uint256", indexed: false },
|
|
561
472
|
{ name: "lst", type: "address", indexed: false },
|
|
562
473
|
{ name: "lstAmount", type: "uint256", indexed: false },
|
|
563
|
-
{ name: "outputToken", type: "address", indexed:
|
|
474
|
+
{ name: "outputToken", type: "address", indexed: false },
|
|
564
475
|
{ name: "outputAmount", type: "uint256", indexed: false },
|
|
565
476
|
],
|
|
566
477
|
},
|
|
567
|
-
|
|
568
|
-
// UnstakeRequested
|
|
569
478
|
{
|
|
570
479
|
type: "event",
|
|
571
480
|
name: "UnstakeRequested",
|
|
572
481
|
inputs: [
|
|
573
482
|
{ name: "user", type: "address", indexed: true },
|
|
574
|
-
{ name: "requestIndex", type: "uint256", indexed:
|
|
483
|
+
{ name: "requestIndex", type: "uint256", indexed: false },
|
|
575
484
|
{ name: "redeemedToken", type: "address", indexed: false },
|
|
576
485
|
{ name: "redeemedAmount", type: "uint256", indexed: false },
|
|
577
486
|
{ name: "slisBNBAmount", type: "uint256", indexed: false },
|
|
578
487
|
],
|
|
579
488
|
},
|
|
580
|
-
|
|
581
|
-
// UnstakeClaimed
|
|
582
489
|
{
|
|
583
490
|
type: "event",
|
|
584
491
|
name: "UnstakeClaimed",
|
|
585
492
|
inputs: [
|
|
586
493
|
{ name: "user", type: "address", indexed: true },
|
|
587
|
-
{ name: "requestIndex", type: "uint256", indexed:
|
|
494
|
+
{ name: "requestIndex", type: "uint256", indexed: false },
|
|
588
495
|
{ name: "bnbAmount", type: "uint256", indexed: false },
|
|
589
496
|
],
|
|
590
497
|
},
|
|
591
|
-
|
|
592
|
-
// DefaultLSTUpdated
|
|
593
498
|
{
|
|
594
499
|
type: "event",
|
|
595
500
|
name: "DefaultLSTUpdated",
|
|
596
501
|
inputs: [
|
|
597
|
-
{ name: "oldLST", type: "address", indexed:
|
|
598
|
-
{ name: "newLST", type: "address", indexed:
|
|
502
|
+
{ name: "oldLST", type: "address", indexed: false },
|
|
503
|
+
{ name: "newLST", type: "address", indexed: false },
|
|
504
|
+
],
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
type: "event",
|
|
508
|
+
name: "OwnershipTransferred",
|
|
509
|
+
inputs: [
|
|
510
|
+
{ name: "previousOwner", type: "address", indexed: true },
|
|
511
|
+
{ name: "newOwner", type: "address", indexed: true },
|
|
599
512
|
],
|
|
600
513
|
},
|
|
601
514
|
|
|
602
515
|
// ============ Errors ============
|
|
603
516
|
|
|
604
|
-
{ type: "error", name: "UnsupportedInputToken", inputs: [] },
|
|
605
|
-
{ type: "error", name: "UnsupportedLST", inputs: [] },
|
|
606
517
|
{ type: "error", name: "DeadlineExpired", inputs: [] },
|
|
518
|
+
{ type: "error", name: "DefaultLSTNotSet", inputs: [] },
|
|
607
519
|
{ type: "error", name: "InsufficientOutput", inputs: [] },
|
|
608
|
-
{ type: "error", name: "
|
|
520
|
+
{ type: "error", name: "InvalidPoolFee", inputs: [] },
|
|
609
521
|
{ type: "error", name: "InvalidRecipient", inputs: [] },
|
|
610
|
-
{ type: "error", name: "
|
|
522
|
+
{ type: "error", name: "InvalidWithdrawalRequest", inputs: [] },
|
|
611
523
|
{ type: "error", name: "MintFailed", inputs: [] },
|
|
612
524
|
{ type: "error", name: "NativeTransferFailed", inputs: [] },
|
|
613
|
-
{ type: "error", name: "InvalidPoolFee", inputs: [] },
|
|
614
|
-
{ type: "error", name: "DefaultLSTNotSet", inputs: [] },
|
|
615
|
-
{ type: "error", name: "InvalidWithdrawalRequest", inputs: [] },
|
|
616
|
-
{ type: "error", name: "WithdrawalNotClaimable", inputs: [] },
|
|
617
|
-
{ type: "error", name: "WithdrawalAlreadyClaimed", inputs: [] },
|
|
618
525
|
{ type: "error", name: "OnlySlisBNBSupported", inputs: [] },
|
|
526
|
+
{ type: "error", name: "SwapFailed", inputs: [] },
|
|
527
|
+
{ type: "error", name: "UnsupportedInputToken", inputs: [] },
|
|
528
|
+
{ type: "error", name: "UnsupportedLST", inputs: [] },
|
|
529
|
+
{ type: "error", name: "V3PoolNotFound", inputs: [] },
|
|
530
|
+
{ type: "error", name: "WithdrawalAlreadyClaimed", inputs: [] },
|
|
531
|
+
{ type: "error", name: "WithdrawalNotClaimable", inputs: [] },
|
|
532
|
+
{ type: "error", name: "ZeroAmount", inputs: [] },
|
|
533
|
+
{ type: "error", name: "ReentrancyGuardReentrantCall", inputs: [] },
|
|
534
|
+
{ type: "error", name: "OwnableInvalidOwner", inputs: [{ name: "owner", type: "address" }] },
|
|
535
|
+
{ type: "error", name: "OwnableUnauthorizedAccount", inputs: [{ name: "account", type: "address" }] },
|
|
536
|
+
{ type: "error", name: "SafeERC20FailedOperation", inputs: [{ name: "token", type: "address" }] },
|
|
537
|
+
|
|
538
|
+
// Receive
|
|
539
|
+
{ type: "receive", stateMutability: "payable" },
|
|
619
540
|
] as const;
|
package/src/index.ts
CHANGED
|
@@ -77,9 +77,7 @@ export type {
|
|
|
77
77
|
RouterRedeemApUSDParams,
|
|
78
78
|
RouterRedeemXBNBParams,
|
|
79
79
|
RouterRedeemAndSwapParams,
|
|
80
|
-
RouterRedeemAndUnstakeParams,
|
|
81
80
|
WithdrawalRequestInfo,
|
|
82
|
-
ExpectedOutput,
|
|
83
81
|
// Router events
|
|
84
82
|
SwapAndMintEvent,
|
|
85
83
|
StakeAndMintEvent,
|
|
@@ -94,6 +92,9 @@ export type {
|
|
|
94
92
|
export { DiamondABI } from "./abi/diamond";
|
|
95
93
|
export { RouterABI } from "./abi/router";
|
|
96
94
|
|
|
95
|
+
// ============ V3 Path Encoding ============
|
|
96
|
+
export { encodeV3Path } from "./types";
|
|
97
|
+
|
|
97
98
|
// ============ Constants ============
|
|
98
99
|
export const PRECISION = 10n ** 18n;
|
|
99
100
|
export const BPS_PRECISION = 10000n;
|