@aspan/sdk 0.4.3 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -457,11 +457,28 @@ declare class AspanReadClient {
457
457
  getOracleBounds(priceFeed: Address): Promise<OracleBounds>;
458
458
  getShares(user: Address): Promise<bigint>;
459
459
  getBalance(user: Address): Promise<bigint>;
460
+ /**
461
+ * Get user's underlying balances (apUSD + xBNB) from sApUSD vault
462
+ */
463
+ getBalanceMulti(user: Address): Promise<{
464
+ apUSDBalance: bigint;
465
+ xBNBBalance: bigint;
466
+ }>;
460
467
  getUserStabilityPoolPosition(user: Address): Promise<UserStabilityPoolPosition>;
461
468
  getExchangeRate(): Promise<bigint>;
462
469
  getTotalStaked(): Promise<bigint>;
463
470
  previewDeposit(assets: bigint): Promise<bigint>;
464
471
  previewRedeem(shares: bigint): Promise<bigint>;
472
+ /**
473
+ * Preview withdraw with multi-asset support (apUSD + xBNB)
474
+ * @param shares Amount of sApUSD shares to redeem
475
+ * @returns Object with apUSD and xBNB amounts, plus whether vault has xBNB
476
+ */
477
+ previewRedeemMulti(shares: bigint): Promise<{
478
+ apUSD: bigint;
479
+ xBNB: bigint;
480
+ hasXBNB: boolean;
481
+ }>;
465
482
  getPendingYield(): Promise<bigint>;
466
483
  getTotalYieldGenerated(): Promise<bigint>;
467
484
  getLSTYieldInfo(lstToken: Address): Promise<LSTYieldInfo>;
@@ -474,6 +491,39 @@ declare class AspanReadClient {
474
491
  getTreasury(): Promise<Address>;
475
492
  getFeeTierCount(): Promise<bigint>;
476
493
  getFeeTier(index: bigint): Promise<FeeTier>;
494
+ /**
495
+ * Get all fee tiers
496
+ * @returns Array of fee tiers sorted by minCR descending
497
+ */
498
+ getAllFeeTiers(): Promise<FeeTier[]>;
499
+ /**
500
+ * Get comprehensive vault (sApUSD) info for frontend display
501
+ * @returns Vault state including TVL, exchange rate, xBNB status
502
+ */
503
+ getVaultInfo(): Promise<{
504
+ totalSupply: bigint;
505
+ totalAssets: bigint;
506
+ exchangeRate: bigint;
507
+ hasXBNB: boolean;
508
+ xBNBAmount: bigint;
509
+ }>;
510
+ /**
511
+ * Get full protocol dashboard data in one call (for frontend overview page)
512
+ * Batches all key metrics into a single multicall
513
+ */
514
+ getProtocolOverview(): Promise<{
515
+ collateralRatio: bigint;
516
+ tvlBNB: bigint;
517
+ tvlUSD: bigint;
518
+ apUSDSupply: bigint;
519
+ xBNBSupply: bigint;
520
+ xBNBPriceUSD: bigint;
521
+ xBNBPriceBNB: bigint;
522
+ bnbPriceUSD: bigint;
523
+ currentFees: CurrentFeeTier;
524
+ stabilityMode: StabilityModeInfo;
525
+ totalStaked: bigint;
526
+ }>;
477
527
  getCurrentFeeTier(): Promise<CurrentFeeTier>;
478
528
  getMaxPriceAge(): Promise<bigint>;
479
529
  getMinDepositPeriod(): Promise<bigint>;
@@ -554,12 +604,18 @@ declare class AspanClient extends AspanReadClient {
554
604
  */
555
605
  triggerStabilityMode2(targetCR?: bigint): Promise<Hash>;
556
606
  /**
557
- * Clean underwater xBNB (burn without getting LST back)
558
- * @description Only works when xBNB is underwater (price = 0)
559
- * @param xBNBAmount Amount of xBNB to clean (burn)
607
+ * Clean xBNB from sApUSD vault by converting back to apUSD
608
+ * @param xBNBAmount Amount of xBNB to clean
609
+ * @param minApUSDOut Minimum apUSD to receive (slippage protection)
560
610
  * @returns Transaction hash
561
611
  */
562
- cleanXbnb(xBNBAmount: bigint): Promise<Hash>;
612
+ cleanVaultXBNB(xBNBAmount: bigint, minApUSDOut?: bigint): Promise<Hash>;
613
+ /**
614
+ * Preview how much apUSD would be minted from cleaning xBNB
615
+ * @param xBNBAmount Amount of xBNB to preview
616
+ * @returns apUSD amount that would be minted
617
+ */
618
+ previewCleanVaultXBNB(xBNBAmount: bigint): Promise<bigint>;
563
619
  /**
564
620
  * Set fee tiers (requires feeManager or owner role)
565
621
  * @param tiers Array of fee tier configurations
@@ -1523,6 +1579,16 @@ declare const DiamondABI: readonly [{
1523
1579
  readonly internalType: "address";
1524
1580
  }];
1525
1581
  readonly stateMutability: "view";
1582
+ }, {
1583
+ readonly type: "function";
1584
+ readonly name: "setSApUSD";
1585
+ readonly inputs: readonly [{
1586
+ readonly name: "_sApUSD";
1587
+ readonly type: "address";
1588
+ readonly internalType: "address";
1589
+ }];
1590
+ readonly outputs: readonly [];
1591
+ readonly stateMutability: "nonpayable";
1526
1592
  }, {
1527
1593
  readonly type: "function";
1528
1594
  readonly name: "getStabilityPool";
@@ -1553,6 +1619,41 @@ declare const DiamondABI: readonly [{
1553
1619
  readonly internalType: "uint256";
1554
1620
  }];
1555
1621
  readonly stateMutability: "view";
1622
+ }, {
1623
+ readonly type: "function";
1624
+ readonly name: "getAllFeeTiers";
1625
+ readonly inputs: readonly [];
1626
+ readonly outputs: readonly [{
1627
+ readonly name: "";
1628
+ readonly type: "tuple[]";
1629
+ readonly internalType: "struct LibAppStorage.FeeTier[]";
1630
+ readonly components: readonly [{
1631
+ readonly name: "minCR";
1632
+ readonly type: "uint256";
1633
+ readonly internalType: "uint256";
1634
+ }, {
1635
+ readonly name: "apUSDMintFee";
1636
+ readonly type: "uint16";
1637
+ readonly internalType: "uint16";
1638
+ }, {
1639
+ readonly name: "apUSDRedeemFee";
1640
+ readonly type: "uint16";
1641
+ readonly internalType: "uint16";
1642
+ }, {
1643
+ readonly name: "xBNBMintFee";
1644
+ readonly type: "uint16";
1645
+ readonly internalType: "uint16";
1646
+ }, {
1647
+ readonly name: "xBNBRedeemFee";
1648
+ readonly type: "uint16";
1649
+ readonly internalType: "uint16";
1650
+ }, {
1651
+ readonly name: "apUSDMintDisabled";
1652
+ readonly type: "bool";
1653
+ readonly internalType: "bool";
1654
+ }];
1655
+ }];
1656
+ readonly stateMutability: "view";
1556
1657
  }, {
1557
1658
  readonly type: "function";
1558
1659
  readonly name: "getFeeTier";
@@ -1741,14 +1842,36 @@ declare const DiamondABI: readonly [{
1741
1842
  readonly stateMutability: "nonpayable";
1742
1843
  }, {
1743
1844
  readonly type: "function";
1744
- readonly name: "cleanXbnb";
1845
+ readonly name: "cleanVaultXBNB";
1745
1846
  readonly inputs: readonly [{
1746
1847
  readonly name: "_xBNBAmount";
1747
1848
  readonly type: "uint256";
1748
1849
  readonly internalType: "uint256";
1850
+ }, {
1851
+ readonly name: "_minApUSDOut";
1852
+ readonly type: "uint256";
1853
+ readonly internalType: "uint256";
1854
+ }];
1855
+ readonly outputs: readonly [{
1856
+ readonly name: "apUSDMinted";
1857
+ readonly type: "uint256";
1858
+ readonly internalType: "uint256";
1749
1859
  }];
1750
- readonly outputs: readonly [];
1751
1860
  readonly stateMutability: "nonpayable";
1861
+ }, {
1862
+ readonly type: "function";
1863
+ readonly name: "previewCleanVaultXBNB";
1864
+ readonly inputs: readonly [{
1865
+ readonly name: "_xBNBAmount";
1866
+ readonly type: "uint256";
1867
+ readonly internalType: "uint256";
1868
+ }];
1869
+ readonly outputs: readonly [{
1870
+ readonly name: "apUSDOut";
1871
+ readonly type: "uint256";
1872
+ readonly internalType: "uint256";
1873
+ }];
1874
+ readonly stateMutability: "view";
1752
1875
  }, {
1753
1876
  readonly type: "event";
1754
1877
  readonly name: "StabilityMode2Triggered";
@@ -2645,7 +2768,7 @@ declare const BSC_ADDRESSES: {
2645
2768
  readonly router: "0x29dd49b2e98674ee7531f17e4d40a7725918c3f6";
2646
2769
  readonly apUSD: "0x4570047eeB5aDb4081c5d470494EB5134e34A287";
2647
2770
  readonly xBNB: "0x0A0c9CD826e747D99F90D63e780B3727Da4D0d43";
2648
- readonly sApUSD: "0x73407A291c007a47CC926EcD5CaC256A1E2d00cF";
2771
+ readonly sApUSD: "0x896770Dba7c0481539E25aaB56bE285ECF6D65eB";
2649
2772
  readonly slisBNB: "0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B";
2650
2773
  readonly asBNB: "0x77734e70b6E88b4d82fE632a168EDf6e700912b6";
2651
2774
  readonly wclisBNB: "0x448f7c2fa4e5135a4a5B50879602cf3CD428e108";
package/dist/index.d.ts CHANGED
@@ -457,11 +457,28 @@ declare class AspanReadClient {
457
457
  getOracleBounds(priceFeed: Address): Promise<OracleBounds>;
458
458
  getShares(user: Address): Promise<bigint>;
459
459
  getBalance(user: Address): Promise<bigint>;
460
+ /**
461
+ * Get user's underlying balances (apUSD + xBNB) from sApUSD vault
462
+ */
463
+ getBalanceMulti(user: Address): Promise<{
464
+ apUSDBalance: bigint;
465
+ xBNBBalance: bigint;
466
+ }>;
460
467
  getUserStabilityPoolPosition(user: Address): Promise<UserStabilityPoolPosition>;
461
468
  getExchangeRate(): Promise<bigint>;
462
469
  getTotalStaked(): Promise<bigint>;
463
470
  previewDeposit(assets: bigint): Promise<bigint>;
464
471
  previewRedeem(shares: bigint): Promise<bigint>;
472
+ /**
473
+ * Preview withdraw with multi-asset support (apUSD + xBNB)
474
+ * @param shares Amount of sApUSD shares to redeem
475
+ * @returns Object with apUSD and xBNB amounts, plus whether vault has xBNB
476
+ */
477
+ previewRedeemMulti(shares: bigint): Promise<{
478
+ apUSD: bigint;
479
+ xBNB: bigint;
480
+ hasXBNB: boolean;
481
+ }>;
465
482
  getPendingYield(): Promise<bigint>;
466
483
  getTotalYieldGenerated(): Promise<bigint>;
467
484
  getLSTYieldInfo(lstToken: Address): Promise<LSTYieldInfo>;
@@ -474,6 +491,39 @@ declare class AspanReadClient {
474
491
  getTreasury(): Promise<Address>;
475
492
  getFeeTierCount(): Promise<bigint>;
476
493
  getFeeTier(index: bigint): Promise<FeeTier>;
494
+ /**
495
+ * Get all fee tiers
496
+ * @returns Array of fee tiers sorted by minCR descending
497
+ */
498
+ getAllFeeTiers(): Promise<FeeTier[]>;
499
+ /**
500
+ * Get comprehensive vault (sApUSD) info for frontend display
501
+ * @returns Vault state including TVL, exchange rate, xBNB status
502
+ */
503
+ getVaultInfo(): Promise<{
504
+ totalSupply: bigint;
505
+ totalAssets: bigint;
506
+ exchangeRate: bigint;
507
+ hasXBNB: boolean;
508
+ xBNBAmount: bigint;
509
+ }>;
510
+ /**
511
+ * Get full protocol dashboard data in one call (for frontend overview page)
512
+ * Batches all key metrics into a single multicall
513
+ */
514
+ getProtocolOverview(): Promise<{
515
+ collateralRatio: bigint;
516
+ tvlBNB: bigint;
517
+ tvlUSD: bigint;
518
+ apUSDSupply: bigint;
519
+ xBNBSupply: bigint;
520
+ xBNBPriceUSD: bigint;
521
+ xBNBPriceBNB: bigint;
522
+ bnbPriceUSD: bigint;
523
+ currentFees: CurrentFeeTier;
524
+ stabilityMode: StabilityModeInfo;
525
+ totalStaked: bigint;
526
+ }>;
477
527
  getCurrentFeeTier(): Promise<CurrentFeeTier>;
478
528
  getMaxPriceAge(): Promise<bigint>;
479
529
  getMinDepositPeriod(): Promise<bigint>;
@@ -554,12 +604,18 @@ declare class AspanClient extends AspanReadClient {
554
604
  */
555
605
  triggerStabilityMode2(targetCR?: bigint): Promise<Hash>;
556
606
  /**
557
- * Clean underwater xBNB (burn without getting LST back)
558
- * @description Only works when xBNB is underwater (price = 0)
559
- * @param xBNBAmount Amount of xBNB to clean (burn)
607
+ * Clean xBNB from sApUSD vault by converting back to apUSD
608
+ * @param xBNBAmount Amount of xBNB to clean
609
+ * @param minApUSDOut Minimum apUSD to receive (slippage protection)
560
610
  * @returns Transaction hash
561
611
  */
562
- cleanXbnb(xBNBAmount: bigint): Promise<Hash>;
612
+ cleanVaultXBNB(xBNBAmount: bigint, minApUSDOut?: bigint): Promise<Hash>;
613
+ /**
614
+ * Preview how much apUSD would be minted from cleaning xBNB
615
+ * @param xBNBAmount Amount of xBNB to preview
616
+ * @returns apUSD amount that would be minted
617
+ */
618
+ previewCleanVaultXBNB(xBNBAmount: bigint): Promise<bigint>;
563
619
  /**
564
620
  * Set fee tiers (requires feeManager or owner role)
565
621
  * @param tiers Array of fee tier configurations
@@ -1523,6 +1579,16 @@ declare const DiamondABI: readonly [{
1523
1579
  readonly internalType: "address";
1524
1580
  }];
1525
1581
  readonly stateMutability: "view";
1582
+ }, {
1583
+ readonly type: "function";
1584
+ readonly name: "setSApUSD";
1585
+ readonly inputs: readonly [{
1586
+ readonly name: "_sApUSD";
1587
+ readonly type: "address";
1588
+ readonly internalType: "address";
1589
+ }];
1590
+ readonly outputs: readonly [];
1591
+ readonly stateMutability: "nonpayable";
1526
1592
  }, {
1527
1593
  readonly type: "function";
1528
1594
  readonly name: "getStabilityPool";
@@ -1553,6 +1619,41 @@ declare const DiamondABI: readonly [{
1553
1619
  readonly internalType: "uint256";
1554
1620
  }];
1555
1621
  readonly stateMutability: "view";
1622
+ }, {
1623
+ readonly type: "function";
1624
+ readonly name: "getAllFeeTiers";
1625
+ readonly inputs: readonly [];
1626
+ readonly outputs: readonly [{
1627
+ readonly name: "";
1628
+ readonly type: "tuple[]";
1629
+ readonly internalType: "struct LibAppStorage.FeeTier[]";
1630
+ readonly components: readonly [{
1631
+ readonly name: "minCR";
1632
+ readonly type: "uint256";
1633
+ readonly internalType: "uint256";
1634
+ }, {
1635
+ readonly name: "apUSDMintFee";
1636
+ readonly type: "uint16";
1637
+ readonly internalType: "uint16";
1638
+ }, {
1639
+ readonly name: "apUSDRedeemFee";
1640
+ readonly type: "uint16";
1641
+ readonly internalType: "uint16";
1642
+ }, {
1643
+ readonly name: "xBNBMintFee";
1644
+ readonly type: "uint16";
1645
+ readonly internalType: "uint16";
1646
+ }, {
1647
+ readonly name: "xBNBRedeemFee";
1648
+ readonly type: "uint16";
1649
+ readonly internalType: "uint16";
1650
+ }, {
1651
+ readonly name: "apUSDMintDisabled";
1652
+ readonly type: "bool";
1653
+ readonly internalType: "bool";
1654
+ }];
1655
+ }];
1656
+ readonly stateMutability: "view";
1556
1657
  }, {
1557
1658
  readonly type: "function";
1558
1659
  readonly name: "getFeeTier";
@@ -1741,14 +1842,36 @@ declare const DiamondABI: readonly [{
1741
1842
  readonly stateMutability: "nonpayable";
1742
1843
  }, {
1743
1844
  readonly type: "function";
1744
- readonly name: "cleanXbnb";
1845
+ readonly name: "cleanVaultXBNB";
1745
1846
  readonly inputs: readonly [{
1746
1847
  readonly name: "_xBNBAmount";
1747
1848
  readonly type: "uint256";
1748
1849
  readonly internalType: "uint256";
1850
+ }, {
1851
+ readonly name: "_minApUSDOut";
1852
+ readonly type: "uint256";
1853
+ readonly internalType: "uint256";
1854
+ }];
1855
+ readonly outputs: readonly [{
1856
+ readonly name: "apUSDMinted";
1857
+ readonly type: "uint256";
1858
+ readonly internalType: "uint256";
1749
1859
  }];
1750
- readonly outputs: readonly [];
1751
1860
  readonly stateMutability: "nonpayable";
1861
+ }, {
1862
+ readonly type: "function";
1863
+ readonly name: "previewCleanVaultXBNB";
1864
+ readonly inputs: readonly [{
1865
+ readonly name: "_xBNBAmount";
1866
+ readonly type: "uint256";
1867
+ readonly internalType: "uint256";
1868
+ }];
1869
+ readonly outputs: readonly [{
1870
+ readonly name: "apUSDOut";
1871
+ readonly type: "uint256";
1872
+ readonly internalType: "uint256";
1873
+ }];
1874
+ readonly stateMutability: "view";
1752
1875
  }, {
1753
1876
  readonly type: "event";
1754
1877
  readonly name: "StabilityMode2Triggered";
@@ -2645,7 +2768,7 @@ declare const BSC_ADDRESSES: {
2645
2768
  readonly router: "0x29dd49b2e98674ee7531f17e4d40a7725918c3f6";
2646
2769
  readonly apUSD: "0x4570047eeB5aDb4081c5d470494EB5134e34A287";
2647
2770
  readonly xBNB: "0x0A0c9CD826e747D99F90D63e780B3727Da4D0d43";
2648
- readonly sApUSD: "0x73407A291c007a47CC926EcD5CaC256A1E2d00cF";
2771
+ readonly sApUSD: "0x896770Dba7c0481539E25aaB56bE285ECF6D65eB";
2649
2772
  readonly slisBNB: "0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B";
2650
2773
  readonly asBNB: "0x77734e70b6E88b4d82fE632a168EDf6e700912b6";
2651
2774
  readonly wclisBNB: "0x448f7c2fa4e5135a4a5B50879602cf3CD428e108";