@oydual31/more-vaults-sdk 0.2.0 → 0.2.1

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.
@@ -2019,6 +2019,27 @@ function useSmartDeposit(vault, hubChainId) {
2019
2019
  reset: isAsync ? omni.reset : simple.reset
2020
2020
  };
2021
2021
  }
2022
+
2023
+ // src/react/useSmartRedeem.ts
2024
+ function useSmartRedeem(vault, hubChainId) {
2025
+ const { data: status } = useVaultStatus(vault, hubChainId);
2026
+ const omni = useOmniRedeem(vault, hubChainId);
2027
+ const simple = useRedeemShares(vault, hubChainId);
2028
+ const isAsync = status?.mode === "cross-chain-async";
2029
+ const redeem = isAsync ? omni.redeem : simple.redeem;
2030
+ return {
2031
+ redeem,
2032
+ isLoading: isAsync ? omni.isLoading : simple.isLoading,
2033
+ txHash: isAsync ? omni.txHash : simple.txHash,
2034
+ assets: isAsync ? void 0 : simple.assets,
2035
+ guid: isAsync ? omni.guid : void 0,
2036
+ requestStatus: isAsync ? omni.requestStatus : void 0,
2037
+ wrongChain: isAsync ? omni.wrongChain : false,
2038
+ vaultMode: status?.mode,
2039
+ error: isAsync ? omni.error : simple.error,
2040
+ reset: isAsync ? omni.reset : simple.reset
2041
+ };
2042
+ }
2022
2043
  function getRouteTokenDecimals(symbol) {
2023
2044
  switch (symbol) {
2024
2045
  case "stgUSDC":
@@ -2057,6 +2078,7 @@ exports.useOmniDeposit = useOmniDeposit;
2057
2078
  exports.useOmniRedeem = useOmniRedeem;
2058
2079
  exports.useRedeemShares = useRedeemShares;
2059
2080
  exports.useSmartDeposit = useSmartDeposit;
2081
+ exports.useSmartRedeem = useSmartRedeem;
2060
2082
  exports.useUserPosition = useUserPosition;
2061
2083
  exports.useVaultDistribution = useVaultDistribution;
2062
2084
  exports.useVaultMetadata = useVaultMetadata;