@aspan/sdk 0.2.1 → 0.3.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/dist/index.mjs CHANGED
@@ -1422,7 +1422,7 @@ import { bsc as bsc2, bscTestnet as bscTestnet2 } from "viem/chains";
1422
1422
 
1423
1423
  // src/abi/router.ts
1424
1424
  var RouterABI = [
1425
- // ============ Core Functions ============
1425
+ // ============ Core Swap+Mint Functions ============
1426
1426
  // swapAndMintApUSD
1427
1427
  {
1428
1428
  type: "function",
@@ -1436,8 +1436,7 @@ var RouterABI = [
1436
1436
  { name: "inputAmount", type: "uint256" },
1437
1437
  { name: "targetLST", type: "address" },
1438
1438
  { name: "minLSTOut", type: "uint256" },
1439
- { name: "poolFee", type: "uint24" },
1440
- { name: "useV2", type: "bool" }
1439
+ { name: "poolFee", type: "uint24" }
1441
1440
  ]
1442
1441
  },
1443
1442
  {
@@ -1470,8 +1469,7 @@ var RouterABI = [
1470
1469
  { name: "inputAmount", type: "uint256" },
1471
1470
  { name: "targetLST", type: "address" },
1472
1471
  { name: "minLSTOut", type: "uint256" },
1473
- { name: "poolFee", type: "uint24" },
1474
- { name: "useV2", type: "bool" }
1472
+ { name: "poolFee", type: "uint24" }
1475
1473
  ]
1476
1474
  },
1477
1475
  {
@@ -1491,6 +1489,7 @@ var RouterABI = [
1491
1489
  ],
1492
1490
  stateMutability: "payable"
1493
1491
  },
1492
+ // ============ Stake+Mint Functions ============
1494
1493
  // stakeAndMint
1495
1494
  {
1496
1495
  type: "function",
@@ -1507,7 +1506,23 @@ var RouterABI = [
1507
1506
  ],
1508
1507
  stateMutability: "payable"
1509
1508
  },
1510
- // ============ Simplified Functions ============
1509
+ // stakeAndMintApUSD (simplified)
1510
+ {
1511
+ type: "function",
1512
+ name: "stakeAndMintApUSD",
1513
+ inputs: [{ name: "minMintOut", type: "uint256" }],
1514
+ outputs: [{ name: "apUSDAmount", type: "uint256" }],
1515
+ stateMutability: "payable"
1516
+ },
1517
+ // stakeAndMintXBNB (simplified)
1518
+ {
1519
+ type: "function",
1520
+ name: "stakeAndMintXBNB",
1521
+ inputs: [{ name: "minMintOut", type: "uint256" }],
1522
+ outputs: [{ name: "xBNBAmount", type: "uint256" }],
1523
+ stateMutability: "payable"
1524
+ },
1525
+ // ============ Simplified Swap+Mint Functions ============
1511
1526
  // swapAndMintApUSDDefault
1512
1527
  {
1513
1528
  type: "function",
@@ -1534,22 +1549,6 @@ var RouterABI = [
1534
1549
  outputs: [{ name: "xBNBAmount", type: "uint256" }],
1535
1550
  stateMutability: "payable"
1536
1551
  },
1537
- // stakeAndMintApUSD
1538
- {
1539
- type: "function",
1540
- name: "stakeAndMintApUSD",
1541
- inputs: [{ name: "minMintOut", type: "uint256" }],
1542
- outputs: [{ name: "apUSDAmount", type: "uint256" }],
1543
- stateMutability: "payable"
1544
- },
1545
- // stakeAndMintXBNB
1546
- {
1547
- type: "function",
1548
- name: "stakeAndMintXBNB",
1549
- inputs: [{ name: "minMintOut", type: "uint256" }],
1550
- outputs: [{ name: "xBNBAmount", type: "uint256" }],
1551
- stateMutability: "payable"
1552
- },
1553
1552
  // ============ Direct Mint/Redeem Functions ============
1554
1553
  // mintApUSD
1555
1554
  {
@@ -1599,7 +1598,7 @@ var RouterABI = [
1599
1598
  outputs: [{ name: "lstAmount", type: "uint256" }],
1600
1599
  stateMutability: "nonpayable"
1601
1600
  },
1602
- // ============ Redeem and Swap Functions ============
1601
+ // ============ Redeem + Swap Functions (V3 path) ============
1603
1602
  // redeemApUSDAndSwap
1604
1603
  {
1605
1604
  type: "function",
@@ -1607,11 +1606,9 @@ var RouterABI = [
1607
1606
  inputs: [
1608
1607
  { name: "lst", type: "address" },
1609
1608
  { name: "apUSDAmount", type: "uint256" },
1610
- { name: "outputToken", type: "address" },
1609
+ { name: "path", type: "bytes" },
1611
1610
  { name: "minOut", type: "uint256" },
1612
- { name: "deadline", type: "uint256" },
1613
- { name: "useV2", type: "bool" },
1614
- { name: "poolFee", type: "uint24" }
1611
+ { name: "deadline", type: "uint256" }
1615
1612
  ],
1616
1613
  outputs: [{ name: "outputAmount", type: "uint256" }],
1617
1614
  stateMutability: "nonpayable"
@@ -1623,39 +1620,11 @@ var RouterABI = [
1623
1620
  inputs: [
1624
1621
  { name: "lst", type: "address" },
1625
1622
  { name: "xBNBAmount", type: "uint256" },
1626
- { name: "outputToken", type: "address" },
1623
+ { name: "path", type: "bytes" },
1627
1624
  { name: "minOut", type: "uint256" },
1628
- { name: "deadline", type: "uint256" },
1629
- { name: "useV2", type: "bool" },
1630
- { name: "poolFee", type: "uint24" }
1631
- ],
1632
- outputs: [{ name: "outputAmount", type: "uint256" }],
1633
- stateMutability: "nonpayable"
1634
- },
1635
- // redeemApUSDAndUnstake
1636
- {
1637
- type: "function",
1638
- name: "redeemApUSDAndUnstake",
1639
- inputs: [
1640
- { name: "lst", type: "address" },
1641
- { name: "apUSDAmount", type: "uint256" },
1642
- { name: "minBNBOut", type: "uint256" },
1643
1625
  { name: "deadline", type: "uint256" }
1644
1626
  ],
1645
- outputs: [{ name: "bnbAmount", type: "uint256" }],
1646
- stateMutability: "nonpayable"
1647
- },
1648
- // redeemXBNBAndUnstake
1649
- {
1650
- type: "function",
1651
- name: "redeemXBNBAndUnstake",
1652
- inputs: [
1653
- { name: "lst", type: "address" },
1654
- { name: "xBNBAmount", type: "uint256" },
1655
- { name: "minBNBOut", type: "uint256" },
1656
- { name: "deadline", type: "uint256" }
1657
- ],
1658
- outputs: [{ name: "bnbAmount", type: "uint256" }],
1627
+ outputs: [{ name: "outputAmount", type: "uint256" }],
1659
1628
  stateMutability: "nonpayable"
1660
1629
  },
1661
1630
  // ============ Native Unstake Functions ============
@@ -1690,71 +1659,38 @@ var RouterABI = [
1690
1659
  stateMutability: "nonpayable"
1691
1660
  },
1692
1661
  // ============ View Functions ============
1693
- // defaultLST
1694
- {
1695
- type: "function",
1696
- name: "defaultLST",
1697
- inputs: [],
1698
- outputs: [{ name: "", type: "address" }],
1699
- stateMutability: "view"
1700
- },
1701
- // supportedInputTokens
1662
+ // Token addresses
1663
+ { type: "function", name: "wbnb", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
1664
+ { type: "function", name: "usdt", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
1665
+ { type: "function", name: "usdc", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
1666
+ { type: "function", name: "slisBNB", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
1667
+ { type: "function", name: "asBNB", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
1668
+ { type: "function", name: "wclisBNB", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
1669
+ { type: "function", name: "apUSD", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
1670
+ { type: "function", name: "xBNB", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
1671
+ // Protocol addresses
1672
+ { type: "function", name: "diamond", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
1673
+ { type: "function", name: "pancakeV3Router", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
1674
+ { type: "function", name: "listaStakeManager", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
1675
+ { type: "function", name: "astherusMinter", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
1676
+ { type: "function", name: "slisBNBProvider", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
1677
+ // Configuration
1678
+ { type: "function", name: "defaultLST", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
1702
1679
  {
1703
1680
  type: "function",
1704
1681
  name: "supportedInputTokens",
1705
1682
  inputs: [{ name: "token", type: "address" }],
1706
- outputs: [{ name: "", type: "bool" }],
1683
+ outputs: [{ type: "bool" }],
1707
1684
  stateMutability: "view"
1708
1685
  },
1709
- // supportedLSTs
1710
1686
  {
1711
1687
  type: "function",
1712
1688
  name: "supportedLSTs",
1713
1689
  inputs: [{ name: "lst", type: "address" }],
1714
- outputs: [{ name: "", type: "bool" }],
1715
- stateMutability: "view"
1716
- },
1717
- // diamond
1718
- {
1719
- type: "function",
1720
- name: "diamond",
1721
- inputs: [],
1722
- outputs: [{ name: "", type: "address" }],
1723
- stateMutability: "view"
1724
- },
1725
- // getExpectedMintOutput
1726
- {
1727
- type: "function",
1728
- name: "getExpectedMintOutput",
1729
- inputs: [
1730
- { name: "inputToken", type: "address" },
1731
- { name: "inputAmount", type: "uint256" },
1732
- { name: "targetLST", type: "address" },
1733
- { name: "isXBNB", type: "bool" }
1734
- ],
1735
- outputs: [
1736
- { name: "expectedLST", type: "uint256" },
1737
- { name: "expectedMint", type: "uint256" }
1738
- ],
1690
+ outputs: [{ type: "bool" }],
1739
1691
  stateMutability: "view"
1740
1692
  },
1741
- // getExpectedRedeemOutput
1742
- {
1743
- type: "function",
1744
- name: "getExpectedRedeemOutput",
1745
- inputs: [
1746
- { name: "isXBNB", type: "bool" },
1747
- { name: "redeemAmount", type: "uint256" },
1748
- { name: "lst", type: "address" },
1749
- { name: "outputToken", type: "address" }
1750
- ],
1751
- outputs: [
1752
- { name: "expectedLST", type: "uint256" },
1753
- { name: "expectedOutput", type: "uint256" }
1754
- ],
1755
- stateMutability: "view"
1756
- },
1757
- // previewMintApUSD
1693
+ // Preview functions
1758
1694
  {
1759
1695
  type: "function",
1760
1696
  name: "previewMintApUSD",
@@ -1765,7 +1701,6 @@ var RouterABI = [
1765
1701
  outputs: [{ name: "apUSDAmount", type: "uint256" }],
1766
1702
  stateMutability: "view"
1767
1703
  },
1768
- // previewMintXBNB
1769
1704
  {
1770
1705
  type: "function",
1771
1706
  name: "previewMintXBNB",
@@ -1776,7 +1711,6 @@ var RouterABI = [
1776
1711
  outputs: [{ name: "xBNBAmount", type: "uint256" }],
1777
1712
  stateMutability: "view"
1778
1713
  },
1779
- // previewRedeemApUSD
1780
1714
  {
1781
1715
  type: "function",
1782
1716
  name: "previewRedeemApUSD",
@@ -1787,7 +1721,6 @@ var RouterABI = [
1787
1721
  outputs: [{ name: "lstAmount", type: "uint256" }],
1788
1722
  stateMutability: "view"
1789
1723
  },
1790
- // previewRedeemXBNB
1791
1724
  {
1792
1725
  type: "function",
1793
1726
  name: "previewRedeemXBNB",
@@ -1798,15 +1731,14 @@ var RouterABI = [
1798
1731
  outputs: [{ name: "lstAmount", type: "uint256" }],
1799
1732
  stateMutability: "view"
1800
1733
  },
1801
- // getUserWithdrawalIndices
1734
+ // Withdrawal tracking
1802
1735
  {
1803
1736
  type: "function",
1804
1737
  name: "getUserWithdrawalIndices",
1805
1738
  inputs: [{ name: "user", type: "address" }],
1806
- outputs: [{ name: "", type: "uint256[]" }],
1739
+ outputs: [{ type: "uint256[]" }],
1807
1740
  stateMutability: "view"
1808
1741
  },
1809
- // getWithdrawalStatus
1810
1742
  {
1811
1743
  type: "function",
1812
1744
  name: "getWithdrawalStatus",
@@ -1817,116 +1749,107 @@ var RouterABI = [
1817
1749
  ],
1818
1750
  stateMutability: "view"
1819
1751
  },
1820
- // Immutable addresses
1821
1752
  {
1822
1753
  type: "function",
1823
- name: "wbnb",
1824
- inputs: [],
1825
- outputs: [{ name: "", type: "address" }],
1826
- stateMutability: "view"
1827
- },
1828
- {
1829
- type: "function",
1830
- name: "usdt",
1831
- inputs: [],
1832
- outputs: [{ name: "", type: "address" }],
1833
- stateMutability: "view"
1834
- },
1835
- {
1836
- type: "function",
1837
- name: "usdc",
1838
- inputs: [],
1839
- outputs: [{ name: "", type: "address" }],
1754
+ name: "withdrawalRequests",
1755
+ inputs: [{ name: "index", type: "uint256" }],
1756
+ outputs: [
1757
+ { name: "user", type: "address" },
1758
+ { name: "listaIdx", type: "uint256" },
1759
+ { name: "slisBNBAmount", type: "uint256" },
1760
+ { name: "claimed", type: "bool" }
1761
+ ],
1840
1762
  stateMutability: "view"
1841
1763
  },
1764
+ // ============ Admin Functions ============
1765
+ { type: "function", name: "owner", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" },
1842
1766
  {
1843
1767
  type: "function",
1844
- name: "slisBNB",
1845
- inputs: [],
1846
- outputs: [{ name: "", type: "address" }],
1847
- stateMutability: "view"
1768
+ name: "setDefaultLST",
1769
+ inputs: [{ name: "lst", type: "address" }],
1770
+ outputs: [],
1771
+ stateMutability: "nonpayable"
1848
1772
  },
1849
1773
  {
1850
1774
  type: "function",
1851
- name: "asBNB",
1852
- inputs: [],
1853
- outputs: [{ name: "", type: "address" }],
1854
- stateMutability: "view"
1775
+ name: "addSupportedInputToken",
1776
+ inputs: [{ name: "token", type: "address" }],
1777
+ outputs: [],
1778
+ stateMutability: "nonpayable"
1855
1779
  },
1856
1780
  {
1857
1781
  type: "function",
1858
- name: "wclisBNB",
1859
- inputs: [],
1860
- outputs: [{ name: "", type: "address" }],
1861
- stateMutability: "view"
1782
+ name: "addSupportedLST",
1783
+ inputs: [{ name: "lst", type: "address" }],
1784
+ outputs: [],
1785
+ stateMutability: "nonpayable"
1862
1786
  },
1863
1787
  {
1864
1788
  type: "function",
1865
- name: "apUSD",
1866
- inputs: [],
1867
- outputs: [{ name: "", type: "address" }],
1868
- stateMutability: "view"
1789
+ name: "rescueTokens",
1790
+ inputs: [
1791
+ { name: "token", type: "address" },
1792
+ { name: "amount", type: "uint256" }
1793
+ ],
1794
+ outputs: [],
1795
+ stateMutability: "nonpayable"
1869
1796
  },
1870
1797
  {
1871
1798
  type: "function",
1872
- name: "xBNB",
1873
- inputs: [],
1874
- outputs: [{ name: "", type: "address" }],
1875
- stateMutability: "view"
1799
+ name: "transferOwnership",
1800
+ inputs: [{ name: "newOwner", type: "address" }],
1801
+ outputs: [],
1802
+ stateMutability: "nonpayable"
1876
1803
  },
1804
+ { type: "function", name: "renounceOwnership", inputs: [], outputs: [], stateMutability: "nonpayable" },
1877
1805
  // ============ Events ============
1878
- // SwapAndMint
1879
1806
  {
1880
1807
  type: "event",
1881
1808
  name: "SwapAndMint",
1882
1809
  inputs: [
1883
1810
  { name: "user", type: "address", indexed: true },
1884
- { name: "inputToken", type: "address", indexed: true },
1811
+ { name: "inputToken", type: "address", indexed: false },
1885
1812
  { name: "inputAmount", type: "uint256", indexed: false },
1886
- { name: "targetLST", type: "address", indexed: true },
1813
+ { name: "lst", type: "address", indexed: false },
1887
1814
  { name: "lstAmount", type: "uint256", indexed: false },
1888
1815
  { name: "mintedToken", type: "address", indexed: false },
1889
1816
  { name: "mintedAmount", type: "uint256", indexed: false }
1890
1817
  ]
1891
1818
  },
1892
- // StakeAndMint
1893
1819
  {
1894
1820
  type: "event",
1895
1821
  name: "StakeAndMint",
1896
1822
  inputs: [
1897
1823
  { name: "user", type: "address", indexed: true },
1898
1824
  { name: "bnbAmount", type: "uint256", indexed: false },
1899
- { name: "targetLST", type: "address", indexed: true },
1825
+ { name: "lst", type: "address", indexed: false },
1900
1826
  { name: "lstAmount", type: "uint256", indexed: false },
1901
- { name: "mintedToken", type: "address", indexed: true },
1827
+ { name: "mintedToken", type: "address", indexed: false },
1902
1828
  { name: "mintedAmount", type: "uint256", indexed: false }
1903
1829
  ]
1904
1830
  },
1905
- // Mint
1906
1831
  {
1907
1832
  type: "event",
1908
1833
  name: "Mint",
1909
1834
  inputs: [
1910
1835
  { name: "user", type: "address", indexed: true },
1911
- { name: "lst", type: "address", indexed: true },
1836
+ { name: "lst", type: "address", indexed: false },
1912
1837
  { name: "lstAmount", type: "uint256", indexed: false },
1913
- { name: "mintedToken", type: "address", indexed: true },
1838
+ { name: "mintedToken", type: "address", indexed: false },
1914
1839
  { name: "mintedAmount", type: "uint256", indexed: false }
1915
1840
  ]
1916
1841
  },
1917
- // Redeem
1918
1842
  {
1919
1843
  type: "event",
1920
1844
  name: "Redeem",
1921
1845
  inputs: [
1922
1846
  { name: "user", type: "address", indexed: true },
1923
- { name: "redeemedToken", type: "address", indexed: true },
1847
+ { name: "redeemedToken", type: "address", indexed: false },
1924
1848
  { name: "redeemedAmount", type: "uint256", indexed: false },
1925
- { name: "lst", type: "address", indexed: true },
1849
+ { name: "lst", type: "address", indexed: false },
1926
1850
  { name: "lstAmount", type: "uint256", indexed: false }
1927
1851
  ]
1928
1852
  },
1929
- // RedeemAndSwap
1930
1853
  {
1931
1854
  type: "event",
1932
1855
  name: "RedeemAndSwap",
@@ -1936,57 +1859,69 @@ var RouterABI = [
1936
1859
  { name: "redeemedAmount", type: "uint256", indexed: false },
1937
1860
  { name: "lst", type: "address", indexed: false },
1938
1861
  { name: "lstAmount", type: "uint256", indexed: false },
1939
- { name: "outputToken", type: "address", indexed: true },
1862
+ { name: "outputToken", type: "address", indexed: false },
1940
1863
  { name: "outputAmount", type: "uint256", indexed: false }
1941
1864
  ]
1942
1865
  },
1943
- // UnstakeRequested
1944
1866
  {
1945
1867
  type: "event",
1946
1868
  name: "UnstakeRequested",
1947
1869
  inputs: [
1948
1870
  { name: "user", type: "address", indexed: true },
1949
- { name: "requestIndex", type: "uint256", indexed: true },
1871
+ { name: "requestIndex", type: "uint256", indexed: false },
1950
1872
  { name: "redeemedToken", type: "address", indexed: false },
1951
1873
  { name: "redeemedAmount", type: "uint256", indexed: false },
1952
1874
  { name: "slisBNBAmount", type: "uint256", indexed: false }
1953
1875
  ]
1954
1876
  },
1955
- // UnstakeClaimed
1956
1877
  {
1957
1878
  type: "event",
1958
1879
  name: "UnstakeClaimed",
1959
1880
  inputs: [
1960
1881
  { name: "user", type: "address", indexed: true },
1961
- { name: "requestIndex", type: "uint256", indexed: true },
1882
+ { name: "requestIndex", type: "uint256", indexed: false },
1962
1883
  { name: "bnbAmount", type: "uint256", indexed: false }
1963
1884
  ]
1964
1885
  },
1965
- // DefaultLSTUpdated
1966
1886
  {
1967
1887
  type: "event",
1968
1888
  name: "DefaultLSTUpdated",
1969
1889
  inputs: [
1970
- { name: "oldLST", type: "address", indexed: true },
1971
- { name: "newLST", type: "address", indexed: true }
1890
+ { name: "oldLST", type: "address", indexed: false },
1891
+ { name: "newLST", type: "address", indexed: false }
1892
+ ]
1893
+ },
1894
+ {
1895
+ type: "event",
1896
+ name: "OwnershipTransferred",
1897
+ inputs: [
1898
+ { name: "previousOwner", type: "address", indexed: true },
1899
+ { name: "newOwner", type: "address", indexed: true }
1972
1900
  ]
1973
1901
  },
1974
1902
  // ============ Errors ============
1975
- { type: "error", name: "UnsupportedInputToken", inputs: [] },
1976
- { type: "error", name: "UnsupportedLST", inputs: [] },
1977
1903
  { type: "error", name: "DeadlineExpired", inputs: [] },
1904
+ { type: "error", name: "DefaultLSTNotSet", inputs: [] },
1978
1905
  { type: "error", name: "InsufficientOutput", inputs: [] },
1979
- { type: "error", name: "ZeroAmount", inputs: [] },
1906
+ { type: "error", name: "InvalidPoolFee", inputs: [] },
1980
1907
  { type: "error", name: "InvalidRecipient", inputs: [] },
1981
- { type: "error", name: "SwapFailed", inputs: [] },
1908
+ { type: "error", name: "InvalidWithdrawalRequest", inputs: [] },
1982
1909
  { type: "error", name: "MintFailed", inputs: [] },
1983
1910
  { type: "error", name: "NativeTransferFailed", inputs: [] },
1984
- { type: "error", name: "InvalidPoolFee", inputs: [] },
1985
- { type: "error", name: "DefaultLSTNotSet", inputs: [] },
1986
- { type: "error", name: "InvalidWithdrawalRequest", inputs: [] },
1987
- { type: "error", name: "WithdrawalNotClaimable", inputs: [] },
1911
+ { type: "error", name: "OnlySlisBNBSupported", inputs: [] },
1912
+ { type: "error", name: "SwapFailed", inputs: [] },
1913
+ { type: "error", name: "UnsupportedInputToken", inputs: [] },
1914
+ { type: "error", name: "UnsupportedLST", inputs: [] },
1915
+ { type: "error", name: "V3PoolNotFound", inputs: [] },
1988
1916
  { type: "error", name: "WithdrawalAlreadyClaimed", inputs: [] },
1989
- { type: "error", name: "OnlySlisBNBSupported", inputs: [] }
1917
+ { type: "error", name: "WithdrawalNotClaimable", inputs: [] },
1918
+ { type: "error", name: "ZeroAmount", inputs: [] },
1919
+ { type: "error", name: "ReentrancyGuardReentrantCall", inputs: [] },
1920
+ { type: "error", name: "OwnableInvalidOwner", inputs: [{ name: "owner", type: "address" }] },
1921
+ { type: "error", name: "OwnableUnauthorizedAccount", inputs: [{ name: "account", type: "address" }] },
1922
+ { type: "error", name: "SafeERC20FailedOperation", inputs: [{ name: "token", type: "address" }] },
1923
+ // Receive
1924
+ { type: "receive", stateMutability: "payable" }
1990
1925
  ];
1991
1926
 
1992
1927
  // src/router.ts
@@ -2045,36 +1980,6 @@ var AspanRouterReadClient = class {
2045
1980
  functionName: "diamond"
2046
1981
  });
2047
1982
  }
2048
- /**
2049
- * Get expected output from a swap and mint operation
2050
- */
2051
- async getExpectedMintOutput(inputToken, inputAmount, targetLST, isXBNB) {
2052
- const result = await this.publicClient.readContract({
2053
- address: this.routerAddress,
2054
- abi: RouterABI,
2055
- functionName: "getExpectedMintOutput",
2056
- args: [inputToken, inputAmount, targetLST, isXBNB]
2057
- });
2058
- return {
2059
- expectedLST: result[0],
2060
- expectedMint: result[1]
2061
- };
2062
- }
2063
- /**
2064
- * Get expected output from a redeem and swap operation
2065
- */
2066
- async getExpectedRedeemOutput(isXBNB, redeemAmount, lst, outputToken) {
2067
- const result = await this.publicClient.readContract({
2068
- address: this.routerAddress,
2069
- abi: RouterABI,
2070
- functionName: "getExpectedRedeemOutput",
2071
- args: [isXBNB, redeemAmount, lst, outputToken]
2072
- });
2073
- return {
2074
- expectedLST: result[0],
2075
- expectedMint: result[1]
2076
- };
2077
- }
2078
1983
  /**
2079
1984
  * Preview apUSD mint output for a given LST amount
2080
1985
  */
@@ -2238,11 +2143,11 @@ var AspanRouterClient = class extends AspanRouterReadClient {
2238
2143
  inputAmount: params.swapParams.inputAmount,
2239
2144
  targetLST: params.swapParams.targetLST,
2240
2145
  minLSTOut: params.swapParams.minLSTOut,
2241
- poolFee: params.swapParams.poolFee,
2242
- useV2: params.swapParams.useV2
2146
+ poolFee: params.swapParams.poolFee
2243
2147
  },
2244
2148
  {
2245
- mintXBNB: params.mintParams.mintXBNB,
2149
+ mintXBNB: false,
2150
+ // swapAndMintApUSD always mints apUSD
2246
2151
  minMintOut: params.mintParams.minMintOut,
2247
2152
  recipient: params.mintParams.recipient,
2248
2153
  deadline: params.mintParams.deadline
@@ -2268,11 +2173,11 @@ var AspanRouterClient = class extends AspanRouterReadClient {
2268
2173
  inputAmount: params.swapParams.inputAmount,
2269
2174
  targetLST: params.swapParams.targetLST,
2270
2175
  minLSTOut: params.swapParams.minLSTOut,
2271
- poolFee: params.swapParams.poolFee,
2272
- useV2: params.swapParams.useV2
2176
+ poolFee: params.swapParams.poolFee
2273
2177
  },
2274
2178
  {
2275
- mintXBNB: params.mintParams.mintXBNB,
2179
+ mintXBNB: true,
2180
+ // swapAndMintXBNB always mints xBNB
2276
2181
  minMintOut: params.mintParams.minMintOut,
2277
2182
  recipient: params.mintParams.recipient,
2278
2183
  deadline: params.mintParams.deadline
@@ -2424,7 +2329,8 @@ var AspanRouterClient = class extends AspanRouterReadClient {
2424
2329
  }
2425
2330
  // ============ Redeem and Swap Functions ============
2426
2331
  /**
2427
- * Redeem apUSD and swap LST to output token
2332
+ * Redeem apUSD and swap LST to output token via V3 path
2333
+ * @param params.path - PancakeSwap V3 encoded path (use encodeV3Path helper)
2428
2334
  */
2429
2335
  async redeemApUSDAndSwap(params) {
2430
2336
  return this.walletClient.writeContract({
@@ -2436,16 +2342,15 @@ var AspanRouterClient = class extends AspanRouterReadClient {
2436
2342
  args: [
2437
2343
  params.lst,
2438
2344
  params.amount,
2439
- params.outputToken,
2345
+ params.path,
2440
2346
  params.minOut,
2441
- params.deadline,
2442
- params.useV2,
2443
- params.poolFee
2347
+ params.deadline
2444
2348
  ]
2445
2349
  });
2446
2350
  }
2447
2351
  /**
2448
- * Redeem xBNB and swap LST to output token
2352
+ * Redeem xBNB and swap LST to output token via V3 path
2353
+ * @param params.path - PancakeSwap V3 encoded path (use encodeV3Path helper)
2449
2354
  */
2450
2355
  async redeemXBNBAndSwap(params) {
2451
2356
  return this.walletClient.writeContract({
@@ -2457,40 +2362,12 @@ var AspanRouterClient = class extends AspanRouterReadClient {
2457
2362
  args: [
2458
2363
  params.lst,
2459
2364
  params.amount,
2460
- params.outputToken,
2365
+ params.path,
2461
2366
  params.minOut,
2462
- params.deadline,
2463
- params.useV2,
2464
- params.poolFee
2367
+ params.deadline
2465
2368
  ]
2466
2369
  });
2467
2370
  }
2468
- /**
2469
- * Redeem apUSD and instantly unstake LST to native BNB via DEX
2470
- */
2471
- async redeemApUSDAndUnstake(params) {
2472
- return this.walletClient.writeContract({
2473
- chain: this.chain,
2474
- account: this.walletClient.account,
2475
- address: this.routerAddress,
2476
- abi: RouterABI,
2477
- functionName: "redeemApUSDAndUnstake",
2478
- args: [params.lst, params.amount, params.minBNBOut, params.deadline]
2479
- });
2480
- }
2481
- /**
2482
- * Redeem xBNB and instantly unstake LST to native BNB via DEX
2483
- */
2484
- async redeemXBNBAndUnstake(params) {
2485
- return this.walletClient.writeContract({
2486
- chain: this.chain,
2487
- account: this.walletClient.account,
2488
- address: this.routerAddress,
2489
- abi: RouterABI,
2490
- functionName: "redeemXBNBAndUnstake",
2491
- args: [params.lst, params.amount, params.minBNBOut, params.deadline]
2492
- });
2493
- }
2494
2371
  // ============ Native Unstake Functions ============
2495
2372
  /**
2496
2373
  * Redeem apUSD and request native unstake from Lista (starts unbonding period)
@@ -2570,6 +2447,19 @@ function createRouterTestnetClient(routerAddress, account, rpcUrl) {
2570
2447
  });
2571
2448
  }
2572
2449
 
2450
+ // src/types.ts
2451
+ function encodeV3Path(tokens, fees) {
2452
+ if (tokens.length < 2) throw new Error("Path must have at least 2 tokens");
2453
+ if (fees.length !== tokens.length - 1) throw new Error("Fees length must be tokens.length - 1");
2454
+ let path = tokens[0].toLowerCase().slice(2);
2455
+ for (let i = 0; i < fees.length; i++) {
2456
+ const feeHex = fees[i].toString(16).padStart(6, "0");
2457
+ path += feeHex;
2458
+ path += tokens[i + 1].toLowerCase().slice(2);
2459
+ }
2460
+ return `0x${path}`;
2461
+ }
2462
+
2573
2463
  // src/index.ts
2574
2464
  var PRECISION = 10n ** 18n;
2575
2465
  var BPS_PRECISION = 10000n;
@@ -2624,6 +2514,7 @@ export {
2624
2514
  createRouterReadClient,
2625
2515
  createRouterTestnetClient,
2626
2516
  createRouterTestnetReadClient,
2517
+ encodeV3Path,
2627
2518
  formatAmount,
2628
2519
  formatCR,
2629
2520
  formatFeeBPS,