@aspan/sdk 0.4.6 → 0.4.8

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 CHANGED
@@ -22,7 +22,7 @@ import { BSC_ADDRESSES } from "@aspan/sdk";
22
22
  | Contract | Address |
23
23
  |----------|---------|
24
24
  | **Diamond (Main Entry)** | `0x6a11B30d3a70727d5477D6d8090e144443fA1c78` |
25
- | **Router** | `0x813d3D1A3154950E2f1d8718305426a335A974A9` |
25
+ | **Router** | `0x34a64c4EbDe830773083BA8c9469456616F6723b` |
26
26
  | **ApUSD** | `0x4570047eeB5aDb4081c5d470494EB5134e34A287` |
27
27
  | **XBNB** | `0x0A0c9CD826e747D99F90D63e780B3727Da4D0d43` |
28
28
  | **SApUSD** | `0xE2BE739C4aA4126ee72D612d9548C38B1B0e5A1b` |
package/dist/index.d.mts CHANGED
@@ -103,10 +103,6 @@ interface DepositParams {
103
103
  interface WithdrawParams {
104
104
  shares: bigint;
105
105
  }
106
- /** Parameters for withdrawing assets from stability pool */
107
- interface WithdrawAssetsParams {
108
- assets: bigint;
109
- }
110
106
  /** Overall protocol statistics */
111
107
  interface ProtocolStats {
112
108
  tvlInBNB: bigint;
@@ -586,12 +582,6 @@ declare class AspanClient extends AspanReadClient {
586
582
  * @returns Transaction hash
587
583
  */
588
584
  withdraw(params: WithdrawParams): Promise<Hash>;
589
- /**
590
- * Withdraw from stability pool by asset amount
591
- * @param params Withdraw parameters
592
- * @returns Transaction hash
593
- */
594
- withdrawAssets(params: WithdrawAssetsParams): Promise<Hash>;
595
585
  /**
596
586
  * Harvest yield from LSTs
597
587
  * @returns Transaction hash
@@ -712,7 +702,9 @@ declare class AspanRouterReadClient {
712
702
  protected readonly publicClient: PublicClient;
713
703
  protected readonly routerAddress: Address;
714
704
  protected readonly chain: Chain;
705
+ private readonly _addressCache;
715
706
  constructor(config: AspanRouterClientConfig);
707
+ protected _getCachedAddress(key: string, fetcher: () => Promise<Address>): Promise<Address>;
716
708
  /**
717
709
  * Get the default LST address
718
710
  */
@@ -725,6 +717,14 @@ declare class AspanRouterReadClient {
725
717
  * Check if an LST is supported
726
718
  */
727
719
  isSupportedLST(lst: Address): Promise<boolean>;
720
+ /**
721
+ * Get LST mode (0 = SYNC, 1 = ASYNC_DIRECT_ONLY)
722
+ */
723
+ getLSTMode(lst: Address): Promise<number>;
724
+ /**
725
+ * Check whether an LST supports routed flows (swap/stake/redeemAndSwap)
726
+ */
727
+ isLSTRoutable(lst: Address): Promise<boolean>;
728
728
  /**
729
729
  * Get the Diamond contract address
730
730
  */
@@ -743,6 +743,22 @@ declare class AspanRouterReadClient {
743
743
  * @param amount Amount of apUSD/xBNB to redeem
744
744
  */
745
745
  previewRedeem(lst: Address, redeemXBNB: boolean, amount: bigint): Promise<bigint>;
746
+ /**
747
+ * SDK-only preview: input token -> estimated LST -> previewMint
748
+ * Note: oracle-based estimation (does not include live DEX slippage/price impact)
749
+ */
750
+ previewMintByInput(inputToken: Address, inputAmount: bigint, targetLST: Address, mintXBNB: boolean): Promise<{
751
+ lstAmount: bigint;
752
+ mintedAmount: bigint;
753
+ }>;
754
+ /**
755
+ * SDK-only preview: previewRedeem -> estimated output token
756
+ * Note: oracle-based estimation (does not include live DEX slippage/price impact)
757
+ */
758
+ previewRedeemToOutput(lst: Address, redeemXBNB: boolean, amount: bigint, outputToken: Address): Promise<{
759
+ lstAmount: bigint;
760
+ outputAmount: bigint;
761
+ }>;
746
762
  /**
747
763
  * Get user's withdrawal request indices
748
764
  */
@@ -1339,20 +1355,6 @@ declare const DiamondABI: readonly [{
1339
1355
  readonly internalType: "uint256";
1340
1356
  }];
1341
1357
  readonly stateMutability: "nonpayable";
1342
- }, {
1343
- readonly type: "function";
1344
- readonly name: "withdrawAssets";
1345
- readonly inputs: readonly [{
1346
- readonly name: "_assets";
1347
- readonly type: "uint256";
1348
- readonly internalType: "uint256";
1349
- }];
1350
- readonly outputs: readonly [{
1351
- readonly name: "shares";
1352
- readonly type: "uint256";
1353
- readonly internalType: "uint256";
1354
- }];
1355
- readonly stateMutability: "nonpayable";
1356
1358
  }, {
1357
1359
  readonly type: "function";
1358
1360
  readonly name: "getShares";
@@ -2330,6 +2332,28 @@ declare const RouterABI: readonly [{
2330
2332
  readonly type: "bool";
2331
2333
  }];
2332
2334
  readonly stateMutability: "view";
2335
+ }, {
2336
+ readonly type: "function";
2337
+ readonly name: "lstModes";
2338
+ readonly inputs: readonly [{
2339
+ readonly name: "lst";
2340
+ readonly type: "address";
2341
+ }];
2342
+ readonly outputs: readonly [{
2343
+ readonly type: "uint8";
2344
+ }];
2345
+ readonly stateMutability: "view";
2346
+ }, {
2347
+ readonly type: "function";
2348
+ readonly name: "isLSTRoutable";
2349
+ readonly inputs: readonly [{
2350
+ readonly name: "lst";
2351
+ readonly type: "address";
2352
+ }];
2353
+ readonly outputs: readonly [{
2354
+ readonly type: "bool";
2355
+ }];
2356
+ readonly stateMutability: "view";
2333
2357
  }, {
2334
2358
  readonly type: "function";
2335
2359
  readonly name: "previewMint";
@@ -2785,7 +2809,7 @@ declare const BPS_PRECISION = 10000n;
2785
2809
  declare const PRICE_PRECISION: bigint;
2786
2810
  declare const BSC_ADDRESSES: {
2787
2811
  readonly diamond: "0x6a11B30d3a70727d5477D6d8090e144443fA1c78";
2788
- readonly router: "0x29dd49b2e98674ee7531f17e4d40a7725918c3f6";
2812
+ readonly router: "0x34a64c4EbDe830773083BA8c9469456616F6723b";
2789
2813
  readonly apUSD: "0x4570047eeB5aDb4081c5d470494EB5134e34A287";
2790
2814
  readonly xBNB: "0x0A0c9CD826e747D99F90D63e780B3727Da4D0d43";
2791
2815
  readonly sApUSD: "0x896770Dba7c0481539E25aaB56bE285ECF6D65eB";
@@ -2845,4 +2869,4 @@ declare function formatPriceUSD(price: bigint): string;
2845
2869
  */
2846
2870
  declare function calculateAPY(previousRate: bigint, currentRate: bigint, periodDays: number): number;
2847
2871
 
2848
- export { type ApUSDMintedEvent, type ApUSDRedeemedEvent, AspanClient, type AspanClientConfig, AspanReadClient, AspanRouterClient, type AspanRouterClientConfig, AspanRouterReadClient, type AspanRouterWriteClientConfig, type AspanWriteClientConfig, BPS_PRECISION, BSC_ADDRESSES, type BigIntString, CHAIN_IDS, type CurrentFeeTier, type CurrentFees, type DepositParams, type DepositedEvent, DiamondABI, type ExpectedOutput, type FeeTier, type LSTInfo, type LSTYieldInfo, type MintApUSDParams, type MintXBNBParams, type OracleBounds, PHAROS_ADDRESSES, PRECISION, PRICE_PRECISION, type ProtocolStats, type RedeemAndSwapEvent, type RedeemApUSDParams, type RedeemXBNBParams, RouterABI, type RouterMintEvent, type RouterMintParams, type RouterMintParams2, type RouterRedeemAndSwapParams, type RouterRedeemAndUnstakeParams, type RouterRedeemEvent, type RouterRedeemParams, type RouterSwapParams, type StabilityMode2Info, type StabilityModeInfo, type StabilityPoolStats, type StakeAndMintEvent, type StakeAndMintParams, type SwapAndMintDefaultParams, type SwapAndMintEvent, type SwapAndMintParams, type TokenAddresses, type TransactionReceipt, type TransactionResult, type UnstakeClaimedEvent, type UnstakeRequestedEvent, type UserStabilityPoolPosition, type WithdrawAssetsParams, type WithdrawParams, type WithdrawalRequestInfo, type WithdrawnEvent, type XBNBMintedEvent, type XBNBRedeemedEvent, type YieldHarvestedEvent, type YieldStats, calculateAPY, createAspanClient, createAspanPharosClient, createAspanPharosReadClient, createAspanReadClient, createAspanReadClientForChain, createAspanTestnetClient, createAspanTestnetReadClient, createAspanWriteClientForChain, createRouterClient, createRouterPharosClient, createRouterPharosReadClient, createRouterReadClient, createRouterReadClientForChain, createRouterTestnetClient, createRouterTestnetReadClient, createRouterWriteClientForChain, encodeV3Path, formatAmount, formatCR, formatFeeBPS, formatPriceUSD, getChainById, parseAmount, pharosTestnet };
2872
+ export { type ApUSDMintedEvent, type ApUSDRedeemedEvent, AspanClient, type AspanClientConfig, AspanReadClient, AspanRouterClient, type AspanRouterClientConfig, AspanRouterReadClient, type AspanRouterWriteClientConfig, type AspanWriteClientConfig, BPS_PRECISION, BSC_ADDRESSES, type BigIntString, CHAIN_IDS, type CurrentFeeTier, type CurrentFees, type DepositParams, type DepositedEvent, DiamondABI, type ExpectedOutput, type FeeTier, type LSTInfo, type LSTYieldInfo, type MintApUSDParams, type MintXBNBParams, type OracleBounds, PHAROS_ADDRESSES, PRECISION, PRICE_PRECISION, type ProtocolStats, type RedeemAndSwapEvent, type RedeemApUSDParams, type RedeemXBNBParams, RouterABI, type RouterMintEvent, type RouterMintParams, type RouterMintParams2, type RouterRedeemAndSwapParams, type RouterRedeemAndUnstakeParams, type RouterRedeemEvent, type RouterRedeemParams, type RouterSwapParams, type StabilityMode2Info, type StabilityModeInfo, type StabilityPoolStats, type StakeAndMintEvent, type StakeAndMintParams, type SwapAndMintDefaultParams, type SwapAndMintEvent, type SwapAndMintParams, type TokenAddresses, type TransactionReceipt, type TransactionResult, type UnstakeClaimedEvent, type UnstakeRequestedEvent, type UserStabilityPoolPosition, type WithdrawParams, type WithdrawalRequestInfo, type WithdrawnEvent, type XBNBMintedEvent, type XBNBRedeemedEvent, type YieldHarvestedEvent, type YieldStats, calculateAPY, createAspanClient, createAspanPharosClient, createAspanPharosReadClient, createAspanReadClient, createAspanReadClientForChain, createAspanTestnetClient, createAspanTestnetReadClient, createAspanWriteClientForChain, createRouterClient, createRouterPharosClient, createRouterPharosReadClient, createRouterReadClient, createRouterReadClientForChain, createRouterTestnetClient, createRouterTestnetReadClient, createRouterWriteClientForChain, encodeV3Path, formatAmount, formatCR, formatFeeBPS, formatPriceUSD, getChainById, parseAmount, pharosTestnet };
package/dist/index.d.ts CHANGED
@@ -103,10 +103,6 @@ interface DepositParams {
103
103
  interface WithdrawParams {
104
104
  shares: bigint;
105
105
  }
106
- /** Parameters for withdrawing assets from stability pool */
107
- interface WithdrawAssetsParams {
108
- assets: bigint;
109
- }
110
106
  /** Overall protocol statistics */
111
107
  interface ProtocolStats {
112
108
  tvlInBNB: bigint;
@@ -586,12 +582,6 @@ declare class AspanClient extends AspanReadClient {
586
582
  * @returns Transaction hash
587
583
  */
588
584
  withdraw(params: WithdrawParams): Promise<Hash>;
589
- /**
590
- * Withdraw from stability pool by asset amount
591
- * @param params Withdraw parameters
592
- * @returns Transaction hash
593
- */
594
- withdrawAssets(params: WithdrawAssetsParams): Promise<Hash>;
595
585
  /**
596
586
  * Harvest yield from LSTs
597
587
  * @returns Transaction hash
@@ -712,7 +702,9 @@ declare class AspanRouterReadClient {
712
702
  protected readonly publicClient: PublicClient;
713
703
  protected readonly routerAddress: Address;
714
704
  protected readonly chain: Chain;
705
+ private readonly _addressCache;
715
706
  constructor(config: AspanRouterClientConfig);
707
+ protected _getCachedAddress(key: string, fetcher: () => Promise<Address>): Promise<Address>;
716
708
  /**
717
709
  * Get the default LST address
718
710
  */
@@ -725,6 +717,14 @@ declare class AspanRouterReadClient {
725
717
  * Check if an LST is supported
726
718
  */
727
719
  isSupportedLST(lst: Address): Promise<boolean>;
720
+ /**
721
+ * Get LST mode (0 = SYNC, 1 = ASYNC_DIRECT_ONLY)
722
+ */
723
+ getLSTMode(lst: Address): Promise<number>;
724
+ /**
725
+ * Check whether an LST supports routed flows (swap/stake/redeemAndSwap)
726
+ */
727
+ isLSTRoutable(lst: Address): Promise<boolean>;
728
728
  /**
729
729
  * Get the Diamond contract address
730
730
  */
@@ -743,6 +743,22 @@ declare class AspanRouterReadClient {
743
743
  * @param amount Amount of apUSD/xBNB to redeem
744
744
  */
745
745
  previewRedeem(lst: Address, redeemXBNB: boolean, amount: bigint): Promise<bigint>;
746
+ /**
747
+ * SDK-only preview: input token -> estimated LST -> previewMint
748
+ * Note: oracle-based estimation (does not include live DEX slippage/price impact)
749
+ */
750
+ previewMintByInput(inputToken: Address, inputAmount: bigint, targetLST: Address, mintXBNB: boolean): Promise<{
751
+ lstAmount: bigint;
752
+ mintedAmount: bigint;
753
+ }>;
754
+ /**
755
+ * SDK-only preview: previewRedeem -> estimated output token
756
+ * Note: oracle-based estimation (does not include live DEX slippage/price impact)
757
+ */
758
+ previewRedeemToOutput(lst: Address, redeemXBNB: boolean, amount: bigint, outputToken: Address): Promise<{
759
+ lstAmount: bigint;
760
+ outputAmount: bigint;
761
+ }>;
746
762
  /**
747
763
  * Get user's withdrawal request indices
748
764
  */
@@ -1339,20 +1355,6 @@ declare const DiamondABI: readonly [{
1339
1355
  readonly internalType: "uint256";
1340
1356
  }];
1341
1357
  readonly stateMutability: "nonpayable";
1342
- }, {
1343
- readonly type: "function";
1344
- readonly name: "withdrawAssets";
1345
- readonly inputs: readonly [{
1346
- readonly name: "_assets";
1347
- readonly type: "uint256";
1348
- readonly internalType: "uint256";
1349
- }];
1350
- readonly outputs: readonly [{
1351
- readonly name: "shares";
1352
- readonly type: "uint256";
1353
- readonly internalType: "uint256";
1354
- }];
1355
- readonly stateMutability: "nonpayable";
1356
1358
  }, {
1357
1359
  readonly type: "function";
1358
1360
  readonly name: "getShares";
@@ -2330,6 +2332,28 @@ declare const RouterABI: readonly [{
2330
2332
  readonly type: "bool";
2331
2333
  }];
2332
2334
  readonly stateMutability: "view";
2335
+ }, {
2336
+ readonly type: "function";
2337
+ readonly name: "lstModes";
2338
+ readonly inputs: readonly [{
2339
+ readonly name: "lst";
2340
+ readonly type: "address";
2341
+ }];
2342
+ readonly outputs: readonly [{
2343
+ readonly type: "uint8";
2344
+ }];
2345
+ readonly stateMutability: "view";
2346
+ }, {
2347
+ readonly type: "function";
2348
+ readonly name: "isLSTRoutable";
2349
+ readonly inputs: readonly [{
2350
+ readonly name: "lst";
2351
+ readonly type: "address";
2352
+ }];
2353
+ readonly outputs: readonly [{
2354
+ readonly type: "bool";
2355
+ }];
2356
+ readonly stateMutability: "view";
2333
2357
  }, {
2334
2358
  readonly type: "function";
2335
2359
  readonly name: "previewMint";
@@ -2785,7 +2809,7 @@ declare const BPS_PRECISION = 10000n;
2785
2809
  declare const PRICE_PRECISION: bigint;
2786
2810
  declare const BSC_ADDRESSES: {
2787
2811
  readonly diamond: "0x6a11B30d3a70727d5477D6d8090e144443fA1c78";
2788
- readonly router: "0x29dd49b2e98674ee7531f17e4d40a7725918c3f6";
2812
+ readonly router: "0x34a64c4EbDe830773083BA8c9469456616F6723b";
2789
2813
  readonly apUSD: "0x4570047eeB5aDb4081c5d470494EB5134e34A287";
2790
2814
  readonly xBNB: "0x0A0c9CD826e747D99F90D63e780B3727Da4D0d43";
2791
2815
  readonly sApUSD: "0x896770Dba7c0481539E25aaB56bE285ECF6D65eB";
@@ -2845,4 +2869,4 @@ declare function formatPriceUSD(price: bigint): string;
2845
2869
  */
2846
2870
  declare function calculateAPY(previousRate: bigint, currentRate: bigint, periodDays: number): number;
2847
2871
 
2848
- export { type ApUSDMintedEvent, type ApUSDRedeemedEvent, AspanClient, type AspanClientConfig, AspanReadClient, AspanRouterClient, type AspanRouterClientConfig, AspanRouterReadClient, type AspanRouterWriteClientConfig, type AspanWriteClientConfig, BPS_PRECISION, BSC_ADDRESSES, type BigIntString, CHAIN_IDS, type CurrentFeeTier, type CurrentFees, type DepositParams, type DepositedEvent, DiamondABI, type ExpectedOutput, type FeeTier, type LSTInfo, type LSTYieldInfo, type MintApUSDParams, type MintXBNBParams, type OracleBounds, PHAROS_ADDRESSES, PRECISION, PRICE_PRECISION, type ProtocolStats, type RedeemAndSwapEvent, type RedeemApUSDParams, type RedeemXBNBParams, RouterABI, type RouterMintEvent, type RouterMintParams, type RouterMintParams2, type RouterRedeemAndSwapParams, type RouterRedeemAndUnstakeParams, type RouterRedeemEvent, type RouterRedeemParams, type RouterSwapParams, type StabilityMode2Info, type StabilityModeInfo, type StabilityPoolStats, type StakeAndMintEvent, type StakeAndMintParams, type SwapAndMintDefaultParams, type SwapAndMintEvent, type SwapAndMintParams, type TokenAddresses, type TransactionReceipt, type TransactionResult, type UnstakeClaimedEvent, type UnstakeRequestedEvent, type UserStabilityPoolPosition, type WithdrawAssetsParams, type WithdrawParams, type WithdrawalRequestInfo, type WithdrawnEvent, type XBNBMintedEvent, type XBNBRedeemedEvent, type YieldHarvestedEvent, type YieldStats, calculateAPY, createAspanClient, createAspanPharosClient, createAspanPharosReadClient, createAspanReadClient, createAspanReadClientForChain, createAspanTestnetClient, createAspanTestnetReadClient, createAspanWriteClientForChain, createRouterClient, createRouterPharosClient, createRouterPharosReadClient, createRouterReadClient, createRouterReadClientForChain, createRouterTestnetClient, createRouterTestnetReadClient, createRouterWriteClientForChain, encodeV3Path, formatAmount, formatCR, formatFeeBPS, formatPriceUSD, getChainById, parseAmount, pharosTestnet };
2872
+ export { type ApUSDMintedEvent, type ApUSDRedeemedEvent, AspanClient, type AspanClientConfig, AspanReadClient, AspanRouterClient, type AspanRouterClientConfig, AspanRouterReadClient, type AspanRouterWriteClientConfig, type AspanWriteClientConfig, BPS_PRECISION, BSC_ADDRESSES, type BigIntString, CHAIN_IDS, type CurrentFeeTier, type CurrentFees, type DepositParams, type DepositedEvent, DiamondABI, type ExpectedOutput, type FeeTier, type LSTInfo, type LSTYieldInfo, type MintApUSDParams, type MintXBNBParams, type OracleBounds, PHAROS_ADDRESSES, PRECISION, PRICE_PRECISION, type ProtocolStats, type RedeemAndSwapEvent, type RedeemApUSDParams, type RedeemXBNBParams, RouterABI, type RouterMintEvent, type RouterMintParams, type RouterMintParams2, type RouterRedeemAndSwapParams, type RouterRedeemAndUnstakeParams, type RouterRedeemEvent, type RouterRedeemParams, type RouterSwapParams, type StabilityMode2Info, type StabilityModeInfo, type StabilityPoolStats, type StakeAndMintEvent, type StakeAndMintParams, type SwapAndMintDefaultParams, type SwapAndMintEvent, type SwapAndMintParams, type TokenAddresses, type TransactionReceipt, type TransactionResult, type UnstakeClaimedEvent, type UnstakeRequestedEvent, type UserStabilityPoolPosition, type WithdrawParams, type WithdrawalRequestInfo, type WithdrawnEvent, type XBNBMintedEvent, type XBNBRedeemedEvent, type YieldHarvestedEvent, type YieldStats, calculateAPY, createAspanClient, createAspanPharosClient, createAspanPharosReadClient, createAspanReadClient, createAspanReadClientForChain, createAspanTestnetClient, createAspanTestnetReadClient, createAspanWriteClientForChain, createRouterClient, createRouterPharosClient, createRouterPharosReadClient, createRouterReadClient, createRouterReadClientForChain, createRouterTestnetClient, createRouterTestnetReadClient, createRouterWriteClientForChain, encodeV3Path, formatAmount, formatCR, formatFeeBPS, formatPriceUSD, getChainById, parseAmount, pharosTestnet };