@aspan/sdk 0.4.2 → 0.4.4

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
@@ -554,12 +554,18 @@ declare class AspanClient extends AspanReadClient {
554
554
  */
555
555
  triggerStabilityMode2(targetCR?: bigint): Promise<Hash>;
556
556
  /**
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)
557
+ * Clean xBNB from sApUSD vault by converting back to apUSD
558
+ * @param xBNBAmount Amount of xBNB to clean
559
+ * @param minApUSDOut Minimum apUSD to receive (slippage protection)
560
560
  * @returns Transaction hash
561
561
  */
562
- cleanXbnb(xBNBAmount: bigint): Promise<Hash>;
562
+ cleanVaultXBNB(xBNBAmount: bigint, minApUSDOut?: bigint): Promise<Hash>;
563
+ /**
564
+ * Preview how much apUSD would be minted from cleaning xBNB
565
+ * @param xBNBAmount Amount of xBNB to preview
566
+ * @returns apUSD amount that would be minted
567
+ */
568
+ previewCleanVaultXBNB(xBNBAmount: bigint): Promise<bigint>;
563
569
  /**
564
570
  * Set fee tiers (requires feeManager or owner role)
565
571
  * @param tiers Array of fee tier configurations
@@ -1741,14 +1747,36 @@ declare const DiamondABI: readonly [{
1741
1747
  readonly stateMutability: "nonpayable";
1742
1748
  }, {
1743
1749
  readonly type: "function";
1744
- readonly name: "cleanXbnb";
1750
+ readonly name: "cleanVaultXBNB";
1745
1751
  readonly inputs: readonly [{
1746
1752
  readonly name: "_xBNBAmount";
1747
1753
  readonly type: "uint256";
1748
1754
  readonly internalType: "uint256";
1755
+ }, {
1756
+ readonly name: "_minApUSDOut";
1757
+ readonly type: "uint256";
1758
+ readonly internalType: "uint256";
1759
+ }];
1760
+ readonly outputs: readonly [{
1761
+ readonly name: "apUSDMinted";
1762
+ readonly type: "uint256";
1763
+ readonly internalType: "uint256";
1749
1764
  }];
1750
- readonly outputs: readonly [];
1751
1765
  readonly stateMutability: "nonpayable";
1766
+ }, {
1767
+ readonly type: "function";
1768
+ readonly name: "previewCleanVaultXBNB";
1769
+ readonly inputs: readonly [{
1770
+ readonly name: "_xBNBAmount";
1771
+ readonly type: "uint256";
1772
+ readonly internalType: "uint256";
1773
+ }];
1774
+ readonly outputs: readonly [{
1775
+ readonly name: "apUSDOut";
1776
+ readonly type: "uint256";
1777
+ readonly internalType: "uint256";
1778
+ }];
1779
+ readonly stateMutability: "view";
1752
1780
  }, {
1753
1781
  readonly type: "event";
1754
1782
  readonly name: "StabilityMode2Triggered";
@@ -2645,7 +2673,7 @@ declare const BSC_ADDRESSES: {
2645
2673
  readonly router: "0x29dd49b2e98674ee7531f17e4d40a7725918c3f6";
2646
2674
  readonly apUSD: "0x4570047eeB5aDb4081c5d470494EB5134e34A287";
2647
2675
  readonly xBNB: "0x0A0c9CD826e747D99F90D63e780B3727Da4D0d43";
2648
- readonly sApUSD: "0x73407A291c007a47CC926EcD5CaC256A1E2d00cF";
2676
+ readonly sApUSD: "0x896770Dba7c0481539E25aaB56bE285ECF6D65eB";
2649
2677
  readonly slisBNB: "0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B";
2650
2678
  readonly asBNB: "0x77734e70b6E88b4d82fE632a168EDf6e700912b6";
2651
2679
  readonly wclisBNB: "0x448f7c2fa4e5135a4a5B50879602cf3CD428e108";
package/dist/index.d.ts CHANGED
@@ -554,12 +554,18 @@ declare class AspanClient extends AspanReadClient {
554
554
  */
555
555
  triggerStabilityMode2(targetCR?: bigint): Promise<Hash>;
556
556
  /**
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)
557
+ * Clean xBNB from sApUSD vault by converting back to apUSD
558
+ * @param xBNBAmount Amount of xBNB to clean
559
+ * @param minApUSDOut Minimum apUSD to receive (slippage protection)
560
560
  * @returns Transaction hash
561
561
  */
562
- cleanXbnb(xBNBAmount: bigint): Promise<Hash>;
562
+ cleanVaultXBNB(xBNBAmount: bigint, minApUSDOut?: bigint): Promise<Hash>;
563
+ /**
564
+ * Preview how much apUSD would be minted from cleaning xBNB
565
+ * @param xBNBAmount Amount of xBNB to preview
566
+ * @returns apUSD amount that would be minted
567
+ */
568
+ previewCleanVaultXBNB(xBNBAmount: bigint): Promise<bigint>;
563
569
  /**
564
570
  * Set fee tiers (requires feeManager or owner role)
565
571
  * @param tiers Array of fee tier configurations
@@ -1741,14 +1747,36 @@ declare const DiamondABI: readonly [{
1741
1747
  readonly stateMutability: "nonpayable";
1742
1748
  }, {
1743
1749
  readonly type: "function";
1744
- readonly name: "cleanXbnb";
1750
+ readonly name: "cleanVaultXBNB";
1745
1751
  readonly inputs: readonly [{
1746
1752
  readonly name: "_xBNBAmount";
1747
1753
  readonly type: "uint256";
1748
1754
  readonly internalType: "uint256";
1755
+ }, {
1756
+ readonly name: "_minApUSDOut";
1757
+ readonly type: "uint256";
1758
+ readonly internalType: "uint256";
1759
+ }];
1760
+ readonly outputs: readonly [{
1761
+ readonly name: "apUSDMinted";
1762
+ readonly type: "uint256";
1763
+ readonly internalType: "uint256";
1749
1764
  }];
1750
- readonly outputs: readonly [];
1751
1765
  readonly stateMutability: "nonpayable";
1766
+ }, {
1767
+ readonly type: "function";
1768
+ readonly name: "previewCleanVaultXBNB";
1769
+ readonly inputs: readonly [{
1770
+ readonly name: "_xBNBAmount";
1771
+ readonly type: "uint256";
1772
+ readonly internalType: "uint256";
1773
+ }];
1774
+ readonly outputs: readonly [{
1775
+ readonly name: "apUSDOut";
1776
+ readonly type: "uint256";
1777
+ readonly internalType: "uint256";
1778
+ }];
1779
+ readonly stateMutability: "view";
1752
1780
  }, {
1753
1781
  readonly type: "event";
1754
1782
  readonly name: "StabilityMode2Triggered";
@@ -2645,7 +2673,7 @@ declare const BSC_ADDRESSES: {
2645
2673
  readonly router: "0x29dd49b2e98674ee7531f17e4d40a7725918c3f6";
2646
2674
  readonly apUSD: "0x4570047eeB5aDb4081c5d470494EB5134e34A287";
2647
2675
  readonly xBNB: "0x0A0c9CD826e747D99F90D63e780B3727Da4D0d43";
2648
- readonly sApUSD: "0x73407A291c007a47CC926EcD5CaC256A1E2d00cF";
2676
+ readonly sApUSD: "0x896770Dba7c0481539E25aaB56bE285ECF6D65eB";
2649
2677
  readonly slisBNB: "0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B";
2650
2678
  readonly asBNB: "0x77734e70b6E88b4d82fE632a168EDf6e700912b6";
2651
2679
  readonly wclisBNB: "0x448f7c2fa4e5135a4a5B50879602cf3CD428e108";
package/dist/index.js CHANGED
@@ -592,11 +592,27 @@ var DiamondABI = [
592
592
  },
593
593
  {
594
594
  type: "function",
595
- name: "cleanXbnb",
596
- inputs: [{ name: "_xBNBAmount", type: "uint256", internalType: "uint256" }],
597
- outputs: [],
595
+ name: "cleanVaultXBNB",
596
+ inputs: [
597
+ { name: "_xBNBAmount", type: "uint256", internalType: "uint256" },
598
+ { name: "_minApUSDOut", type: "uint256", internalType: "uint256" }
599
+ ],
600
+ outputs: [
601
+ { name: "apUSDMinted", type: "uint256", internalType: "uint256" }
602
+ ],
598
603
  stateMutability: "nonpayable"
599
604
  },
605
+ {
606
+ type: "function",
607
+ name: "previewCleanVaultXBNB",
608
+ inputs: [
609
+ { name: "_xBNBAmount", type: "uint256", internalType: "uint256" }
610
+ ],
611
+ outputs: [
612
+ { name: "apUSDOut", type: "uint256", internalType: "uint256" }
613
+ ],
614
+ stateMutability: "view"
615
+ },
600
616
  // ============ StabilityModeFacet Events ============
601
617
  {
602
618
  type: "event",
@@ -1569,18 +1585,31 @@ var AspanClient = class extends AspanReadClient {
1569
1585
  });
1570
1586
  }
1571
1587
  /**
1572
- * Clean underwater xBNB (burn without getting LST back)
1573
- * @description Only works when xBNB is underwater (price = 0)
1574
- * @param xBNBAmount Amount of xBNB to clean (burn)
1588
+ * Clean xBNB from sApUSD vault by converting back to apUSD
1589
+ * @param xBNBAmount Amount of xBNB to clean
1590
+ * @param minApUSDOut Minimum apUSD to receive (slippage protection)
1575
1591
  * @returns Transaction hash
1576
1592
  */
1577
- async cleanXbnb(xBNBAmount) {
1593
+ async cleanVaultXBNB(xBNBAmount, minApUSDOut = 0n) {
1578
1594
  return this.walletClient.writeContract({
1579
1595
  chain: this.chain,
1580
1596
  account: this.walletClient.account,
1581
1597
  address: this.diamondAddress,
1582
1598
  abi: DiamondABI,
1583
- functionName: "cleanXbnb",
1599
+ functionName: "cleanVaultXBNB",
1600
+ args: [xBNBAmount, minApUSDOut]
1601
+ });
1602
+ }
1603
+ /**
1604
+ * Preview how much apUSD would be minted from cleaning xBNB
1605
+ * @param xBNBAmount Amount of xBNB to preview
1606
+ * @returns apUSD amount that would be minted
1607
+ */
1608
+ async previewCleanVaultXBNB(xBNBAmount) {
1609
+ return this.publicClient.readContract({
1610
+ address: this.diamondAddress,
1611
+ abi: DiamondABI,
1612
+ functionName: "previewCleanVaultXBNB",
1584
1613
  args: [xBNBAmount]
1585
1614
  });
1586
1615
  }
@@ -2494,7 +2523,7 @@ var BSC_ADDRESSES = {
2494
2523
  router: "0x29dd49b2e98674ee7531f17e4d40a7725918c3f6",
2495
2524
  apUSD: "0x4570047eeB5aDb4081c5d470494EB5134e34A287",
2496
2525
  xBNB: "0x0A0c9CD826e747D99F90D63e780B3727Da4D0d43",
2497
- sApUSD: "0x73407A291c007a47CC926EcD5CaC256A1E2d00cF",
2526
+ sApUSD: "0x896770Dba7c0481539E25aaB56bE285ECF6D65eB",
2498
2527
  // LSTs
2499
2528
  slisBNB: "0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B",
2500
2529
  asBNB: "0x77734e70b6E88b4d82fE632a168EDf6e700912b6",
package/dist/index.mjs CHANGED
@@ -534,11 +534,27 @@ var DiamondABI = [
534
534
  },
535
535
  {
536
536
  type: "function",
537
- name: "cleanXbnb",
538
- inputs: [{ name: "_xBNBAmount", type: "uint256", internalType: "uint256" }],
539
- outputs: [],
537
+ name: "cleanVaultXBNB",
538
+ inputs: [
539
+ { name: "_xBNBAmount", type: "uint256", internalType: "uint256" },
540
+ { name: "_minApUSDOut", type: "uint256", internalType: "uint256" }
541
+ ],
542
+ outputs: [
543
+ { name: "apUSDMinted", type: "uint256", internalType: "uint256" }
544
+ ],
540
545
  stateMutability: "nonpayable"
541
546
  },
547
+ {
548
+ type: "function",
549
+ name: "previewCleanVaultXBNB",
550
+ inputs: [
551
+ { name: "_xBNBAmount", type: "uint256", internalType: "uint256" }
552
+ ],
553
+ outputs: [
554
+ { name: "apUSDOut", type: "uint256", internalType: "uint256" }
555
+ ],
556
+ stateMutability: "view"
557
+ },
542
558
  // ============ StabilityModeFacet Events ============
543
559
  {
544
560
  type: "event",
@@ -1511,18 +1527,31 @@ var AspanClient = class extends AspanReadClient {
1511
1527
  });
1512
1528
  }
1513
1529
  /**
1514
- * Clean underwater xBNB (burn without getting LST back)
1515
- * @description Only works when xBNB is underwater (price = 0)
1516
- * @param xBNBAmount Amount of xBNB to clean (burn)
1530
+ * Clean xBNB from sApUSD vault by converting back to apUSD
1531
+ * @param xBNBAmount Amount of xBNB to clean
1532
+ * @param minApUSDOut Minimum apUSD to receive (slippage protection)
1517
1533
  * @returns Transaction hash
1518
1534
  */
1519
- async cleanXbnb(xBNBAmount) {
1535
+ async cleanVaultXBNB(xBNBAmount, minApUSDOut = 0n) {
1520
1536
  return this.walletClient.writeContract({
1521
1537
  chain: this.chain,
1522
1538
  account: this.walletClient.account,
1523
1539
  address: this.diamondAddress,
1524
1540
  abi: DiamondABI,
1525
- functionName: "cleanXbnb",
1541
+ functionName: "cleanVaultXBNB",
1542
+ args: [xBNBAmount, minApUSDOut]
1543
+ });
1544
+ }
1545
+ /**
1546
+ * Preview how much apUSD would be minted from cleaning xBNB
1547
+ * @param xBNBAmount Amount of xBNB to preview
1548
+ * @returns apUSD amount that would be minted
1549
+ */
1550
+ async previewCleanVaultXBNB(xBNBAmount) {
1551
+ return this.publicClient.readContract({
1552
+ address: this.diamondAddress,
1553
+ abi: DiamondABI,
1554
+ functionName: "previewCleanVaultXBNB",
1526
1555
  args: [xBNBAmount]
1527
1556
  });
1528
1557
  }
@@ -2441,7 +2470,7 @@ var BSC_ADDRESSES = {
2441
2470
  router: "0x29dd49b2e98674ee7531f17e4d40a7725918c3f6",
2442
2471
  apUSD: "0x4570047eeB5aDb4081c5d470494EB5134e34A287",
2443
2472
  xBNB: "0x0A0c9CD826e747D99F90D63e780B3727Da4D0d43",
2444
- sApUSD: "0x73407A291c007a47CC926EcD5CaC256A1E2d00cF",
2473
+ sApUSD: "0x896770Dba7c0481539E25aaB56bE285ECF6D65eB",
2445
2474
  // LSTs
2446
2475
  slisBNB: "0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B",
2447
2476
  asBNB: "0x77734e70b6E88b4d82fE632a168EDf6e700912b6",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aspan/sdk",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "TypeScript SDK for Aspan Protocol - LST-backed stablecoin on BNB Chain",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -536,11 +536,27 @@ export const DiamondABI = [
536
536
  },
537
537
  {
538
538
  type: "function",
539
- name: "cleanXbnb",
540
- inputs: [{ name: "_xBNBAmount", type: "uint256", internalType: "uint256" }],
541
- outputs: [],
539
+ name: "cleanVaultXBNB",
540
+ inputs: [
541
+ { name: "_xBNBAmount", type: "uint256", internalType: "uint256" },
542
+ { name: "_minApUSDOut", type: "uint256", internalType: "uint256" }
543
+ ],
544
+ outputs: [
545
+ { name: "apUSDMinted", type: "uint256", internalType: "uint256" }
546
+ ],
542
547
  stateMutability: "nonpayable"
543
548
  },
549
+ {
550
+ type: "function",
551
+ name: "previewCleanVaultXBNB",
552
+ inputs: [
553
+ { name: "_xBNBAmount", type: "uint256", internalType: "uint256" }
554
+ ],
555
+ outputs: [
556
+ { name: "apUSDOut", type: "uint256", internalType: "uint256" }
557
+ ],
558
+ stateMutability: "view"
559
+ },
544
560
 
545
561
  // ============ StabilityModeFacet Events ============
546
562
  {
package/src/client.ts CHANGED
@@ -1115,22 +1115,36 @@ export class AspanClient extends AspanReadClient {
1115
1115
  }
1116
1116
 
1117
1117
  /**
1118
- * Clean underwater xBNB (burn without getting LST back)
1119
- * @description Only works when xBNB is underwater (price = 0)
1120
- * @param xBNBAmount Amount of xBNB to clean (burn)
1118
+ * Clean xBNB from sApUSD vault by converting back to apUSD
1119
+ * @param xBNBAmount Amount of xBNB to clean
1120
+ * @param minApUSDOut Minimum apUSD to receive (slippage protection)
1121
1121
  * @returns Transaction hash
1122
1122
  */
1123
- async cleanXbnb(xBNBAmount: bigint): Promise<Hash> {
1123
+ async cleanVaultXBNB(xBNBAmount: bigint, minApUSDOut: bigint = 0n): Promise<Hash> {
1124
1124
  return this.walletClient.writeContract({
1125
1125
  chain: this.chain,
1126
1126
  account: this.walletClient.account!,
1127
1127
  address: this.diamondAddress,
1128
1128
  abi: DiamondABI,
1129
- functionName: "cleanXbnb",
1130
- args: [xBNBAmount],
1129
+ functionName: "cleanVaultXBNB",
1130
+ args: [xBNBAmount, minApUSDOut],
1131
1131
  });
1132
1132
  }
1133
1133
 
1134
+ /**
1135
+ * Preview how much apUSD would be minted from cleaning xBNB
1136
+ * @param xBNBAmount Amount of xBNB to preview
1137
+ * @returns apUSD amount that would be minted
1138
+ */
1139
+ async previewCleanVaultXBNB(xBNBAmount: bigint): Promise<bigint> {
1140
+ return this.publicClient.readContract({
1141
+ address: this.diamondAddress,
1142
+ abi: DiamondABI,
1143
+ functionName: "previewCleanVaultXBNB",
1144
+ args: [xBNBAmount],
1145
+ }) as Promise<bigint>;
1146
+ }
1147
+
1134
1148
  // ============ Fee Management Functions ============
1135
1149
 
1136
1150
  /**
package/src/index.ts CHANGED
@@ -120,7 +120,7 @@ export const BSC_ADDRESSES = {
120
120
  router: "0x29dd49b2e98674ee7531f17e4d40a7725918c3f6" as const,
121
121
  apUSD: "0x4570047eeB5aDb4081c5d470494EB5134e34A287" as const,
122
122
  xBNB: "0x0A0c9CD826e747D99F90D63e780B3727Da4D0d43" as const,
123
- sApUSD: "0x73407A291c007a47CC926EcD5CaC256A1E2d00cF" as const,
123
+ sApUSD: "0x896770Dba7c0481539E25aaB56bE285ECF6D65eB" as const,
124
124
  // LSTs
125
125
  slisBNB: "0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B" as const,
126
126
  asBNB: "0x77734e70b6E88b4d82fE632a168EDf6e700912b6" as const,