@aspan/sdk 0.1.8 → 0.2.0
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 +218 -0
- package/dist/index.d.mts +1183 -1
- package/dist/index.d.ts +1183 -1
- package/dist/index.js +1049 -0
- package/dist/index.mjs +1047 -0
- package/package.json +1 -1
- package/src/abi/router.ts +554 -0
- package/src/index.ts +35 -0
- package/src/router.ts +686 -0
- package/src/types.ts +218 -0
package/src/types.ts
CHANGED
|
@@ -243,3 +243,221 @@ export interface TransactionReceipt {
|
|
|
243
243
|
transactionHash: Hash;
|
|
244
244
|
status: "success" | "reverted";
|
|
245
245
|
}
|
|
246
|
+
|
|
247
|
+
// ============ Router Types ============
|
|
248
|
+
|
|
249
|
+
/** Router swap parameters */
|
|
250
|
+
export interface RouterSwapParams {
|
|
251
|
+
/** Input token address (address(0) for native BNB) */
|
|
252
|
+
inputToken: Address;
|
|
253
|
+
/** Amount of input token */
|
|
254
|
+
inputAmount: bigint;
|
|
255
|
+
/** Target LST address (address(0) uses default LST) */
|
|
256
|
+
targetLST: Address;
|
|
257
|
+
/** Minimum LST to receive from swap (slippage protection) */
|
|
258
|
+
minLSTOut: bigint;
|
|
259
|
+
/** PancakeSwap V3 pool fee tier (500, 2500, 10000) */
|
|
260
|
+
poolFee: number;
|
|
261
|
+
/** true = PancakeSwap V2, false = V3 */
|
|
262
|
+
useV2: boolean;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** Router mint parameters */
|
|
266
|
+
export interface RouterMintParams {
|
|
267
|
+
/** true = mint xBNB, false = mint apUSD */
|
|
268
|
+
mintXBNB: boolean;
|
|
269
|
+
/** Minimum output to receive (slippage protection) */
|
|
270
|
+
minMintOut: bigint;
|
|
271
|
+
/** Recipient of minted tokens (address(0) = msg.sender) */
|
|
272
|
+
recipient: Address;
|
|
273
|
+
/** Transaction deadline timestamp */
|
|
274
|
+
deadline: bigint;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/** Parameters for swapAndMint functions */
|
|
278
|
+
export interface SwapAndMintParams {
|
|
279
|
+
swapParams: RouterSwapParams;
|
|
280
|
+
mintParams: RouterMintParams;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/** Parameters for stakeAndMint function */
|
|
284
|
+
export interface StakeAndMintParams {
|
|
285
|
+
/** Target LST (slisBNB, asBNB, wclisBNB) */
|
|
286
|
+
targetLST: Address;
|
|
287
|
+
/** true = mint xBNB, false = mint apUSD */
|
|
288
|
+
mintXBNB: boolean;
|
|
289
|
+
/** Minimum output to receive */
|
|
290
|
+
minMintOut: bigint;
|
|
291
|
+
/** Transaction deadline timestamp */
|
|
292
|
+
deadline: bigint;
|
|
293
|
+
/** Native BNB amount to stake */
|
|
294
|
+
value: bigint;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/** Parameters for simplified swap and mint functions */
|
|
298
|
+
export interface SwapAndMintDefaultParams {
|
|
299
|
+
/** Input token address (address(0) for native BNB) */
|
|
300
|
+
inputToken: Address;
|
|
301
|
+
/** Amount of input token */
|
|
302
|
+
inputAmount: bigint;
|
|
303
|
+
/** Minimum output to receive */
|
|
304
|
+
minMintOut: bigint;
|
|
305
|
+
/** Transaction deadline timestamp */
|
|
306
|
+
deadline: bigint;
|
|
307
|
+
/** Native BNB amount (if inputToken is address(0)) */
|
|
308
|
+
value?: bigint;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/** Parameters for router direct mint functions */
|
|
312
|
+
export interface RouterMintApUSDParams {
|
|
313
|
+
/** LST token address */
|
|
314
|
+
lst: Address;
|
|
315
|
+
/** Amount of LST to deposit */
|
|
316
|
+
lstAmount: bigint;
|
|
317
|
+
/** Minimum apUSD to receive */
|
|
318
|
+
minOut?: bigint;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/** Parameters for router direct mint xBNB functions */
|
|
322
|
+
export interface RouterMintXBNBParams {
|
|
323
|
+
/** LST token address */
|
|
324
|
+
lst: Address;
|
|
325
|
+
/** Amount of LST to deposit */
|
|
326
|
+
lstAmount: bigint;
|
|
327
|
+
/** Minimum xBNB to receive */
|
|
328
|
+
minOut?: bigint;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/** Parameters for router redeem apUSD functions */
|
|
332
|
+
export interface RouterRedeemApUSDParams {
|
|
333
|
+
/** LST token to receive */
|
|
334
|
+
lst: Address;
|
|
335
|
+
/** Amount of apUSD to redeem */
|
|
336
|
+
apUSDAmount: bigint;
|
|
337
|
+
/** Minimum LST to receive */
|
|
338
|
+
minOut?: bigint;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/** Parameters for router redeem xBNB functions */
|
|
342
|
+
export interface RouterRedeemXBNBParams {
|
|
343
|
+
/** LST token to receive */
|
|
344
|
+
lst: Address;
|
|
345
|
+
/** Amount of xBNB to redeem */
|
|
346
|
+
xBNBAmount: bigint;
|
|
347
|
+
/** Minimum LST to receive */
|
|
348
|
+
minOut?: bigint;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** Parameters for redeemAndSwap functions */
|
|
352
|
+
export interface RouterRedeemAndSwapParams {
|
|
353
|
+
/** LST to redeem */
|
|
354
|
+
lst: Address;
|
|
355
|
+
/** Amount to redeem (apUSD or xBNB) */
|
|
356
|
+
amount: bigint;
|
|
357
|
+
/** Output token (address(0) for native BNB) */
|
|
358
|
+
outputToken: Address;
|
|
359
|
+
/** Minimum output to receive */
|
|
360
|
+
minOut: bigint;
|
|
361
|
+
/** Transaction deadline timestamp */
|
|
362
|
+
deadline: bigint;
|
|
363
|
+
/** true = PancakeSwap V2, false = V3 */
|
|
364
|
+
useV2: boolean;
|
|
365
|
+
/** V3 pool fee tier (ignored if useV2) */
|
|
366
|
+
poolFee: number;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/** Parameters for redeemAndUnstake functions */
|
|
370
|
+
export interface RouterRedeemAndUnstakeParams {
|
|
371
|
+
/** LST to redeem */
|
|
372
|
+
lst: Address;
|
|
373
|
+
/** Amount to redeem (apUSD or xBNB) */
|
|
374
|
+
amount: bigint;
|
|
375
|
+
/** Minimum BNB to receive */
|
|
376
|
+
minBNBOut: bigint;
|
|
377
|
+
/** Transaction deadline timestamp */
|
|
378
|
+
deadline: bigint;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/** Withdrawal request status */
|
|
382
|
+
export interface WithdrawalRequestInfo {
|
|
383
|
+
/** Whether the request can be claimed */
|
|
384
|
+
isClaimable: boolean;
|
|
385
|
+
/** Amount of BNB to receive */
|
|
386
|
+
bnbAmount: bigint;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/** Expected output from swap and mint */
|
|
390
|
+
export interface ExpectedOutput {
|
|
391
|
+
/** Expected LST from swap */
|
|
392
|
+
expectedLST: bigint;
|
|
393
|
+
/** Expected apUSD/xBNB from mint */
|
|
394
|
+
expectedMint: bigint;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// ============ Router Event Types ============
|
|
398
|
+
|
|
399
|
+
/** SwapAndMint event */
|
|
400
|
+
export interface SwapAndMintEvent {
|
|
401
|
+
user: Address;
|
|
402
|
+
inputToken: Address;
|
|
403
|
+
inputAmount: bigint;
|
|
404
|
+
targetLST: Address;
|
|
405
|
+
lstAmount: bigint;
|
|
406
|
+
mintedToken: Address;
|
|
407
|
+
mintedAmount: bigint;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/** StakeAndMint event */
|
|
411
|
+
export interface StakeAndMintEvent {
|
|
412
|
+
user: Address;
|
|
413
|
+
bnbAmount: bigint;
|
|
414
|
+
targetLST: Address;
|
|
415
|
+
lstAmount: bigint;
|
|
416
|
+
mintedToken: Address;
|
|
417
|
+
mintedAmount: bigint;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/** Router Mint event */
|
|
421
|
+
export interface RouterMintEvent {
|
|
422
|
+
user: Address;
|
|
423
|
+
lst: Address;
|
|
424
|
+
lstAmount: bigint;
|
|
425
|
+
mintedToken: Address;
|
|
426
|
+
mintedAmount: bigint;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/** Router Redeem event */
|
|
430
|
+
export interface RouterRedeemEvent {
|
|
431
|
+
user: Address;
|
|
432
|
+
redeemedToken: Address;
|
|
433
|
+
redeemedAmount: bigint;
|
|
434
|
+
lst: Address;
|
|
435
|
+
lstAmount: bigint;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/** RedeemAndSwap event */
|
|
439
|
+
export interface RedeemAndSwapEvent {
|
|
440
|
+
user: Address;
|
|
441
|
+
redeemedToken: Address;
|
|
442
|
+
redeemedAmount: bigint;
|
|
443
|
+
lst: Address;
|
|
444
|
+
lstAmount: bigint;
|
|
445
|
+
outputToken: Address;
|
|
446
|
+
outputAmount: bigint;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/** UnstakeRequested event */
|
|
450
|
+
export interface UnstakeRequestedEvent {
|
|
451
|
+
user: Address;
|
|
452
|
+
requestIndex: bigint;
|
|
453
|
+
redeemedToken: Address;
|
|
454
|
+
redeemedAmount: bigint;
|
|
455
|
+
slisBNBAmount: bigint;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/** UnstakeClaimed event */
|
|
459
|
+
export interface UnstakeClaimedEvent {
|
|
460
|
+
user: Address;
|
|
461
|
+
requestIndex: bigint;
|
|
462
|
+
bnbAmount: bigint;
|
|
463
|
+
}
|