@huma-finance/widgets 0.0.77-beta.1008 → 0.0.77-beta.1012

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.js CHANGED
@@ -182864,15 +182864,17 @@ function ConfirmTransfer$2({
182864
182864
  subTitle: "Withdraw all the available amount",
182865
182865
  children: [
182866
182866
  /* @__PURE__ */ jsxs(Box, { css: pr.itemWrapper, children: [
182867
- /* @__PURE__ */ jsxs(Box, { css: pr.item, children: [
182868
- /* @__PURE__ */ jsx(Box, { children: "Price Per Share" }),
182869
- /* @__PURE__ */ jsxs(Box, { css: pr.itemValue, children: [
182870
- ur.toFixed(1),
182871
- " ",
182872
- lr
182873
- ] })
182867
+ ur !== 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
182868
+ /* @__PURE__ */ jsxs(Box, { css: pr.item, children: [
182869
+ /* @__PURE__ */ jsx(Box, { children: "Price Per Share" }),
182870
+ /* @__PURE__ */ jsxs(Box, { css: pr.itemValue, children: [
182871
+ ur.toFixed(1),
182872
+ " ",
182873
+ lr
182874
+ ] })
182875
+ ] }),
182876
+ /* @__PURE__ */ jsx(Divider, { css: pr.divider, orientation: "horizontal" })
182874
182877
  ] }),
182875
- /* @__PURE__ */ jsx(Divider, { css: pr.divider, orientation: "horizontal" }),
182876
182878
  /* @__PURE__ */ jsxs(Box, { css: pr.item, children: [
182877
182879
  /* @__PURE__ */ jsx(Box, { fontWeight: 700, children: "Available to withdraw" }),
182878
182880
  /* @__PURE__ */ jsxs(Box, { css: pr.itemValue, children: [
@@ -183021,7 +183023,9 @@ function SolanaLendWithdraw({
183021
183023
  new LoggingContextHelper(Vr).logAction("StartFlow", {}), pr(setLoggingContext(Vr)), pr(setStep(WIDGET_STEP.ConfirmTransfer));
183022
183024
  }
183023
183025
  }, [pr, ar.chainId, ar.poolName, ar.poolType, hr]), useEffect(() => {
183024
- const Vr = fr === "senior" ? or.seniorTrancheAssets : or.juniorTrancheAssets, Yr = new BN$1(Vr ?? 1), Dr = new BN$1(cr.supply.toString() ?? 1), br = Yr.muln(1e5).div(Dr).toNumber() / 1e5;
183026
+ const Vr = fr === "senior" ? or.seniorTrancheAssets : or.juniorTrancheAssets, Yr = new BN$1(Vr ?? 1), Dr = new BN$1(
183027
+ cr.supply.toString()
183028
+ ).isZero() ? new BN$1(1) : new BN$1(cr.supply.toString()), br = Yr.muln(1e5).div(Dr).toNumber() / 1e5;
183025
183029
  Cr(br);
183026
183030
  }, [
183027
183031
  or.juniorTrancheAssets,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huma-finance/widgets",
3
- "version": "0.0.77-beta.1008+fe452c1",
3
+ "version": "0.0.77-beta.1012+7359b01",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -22,9 +22,9 @@
22
22
  "@ethersproject/contracts": "^5.7.0",
23
23
  "@ethersproject/experimental": "^5.7.0",
24
24
  "@ethersproject/units": "^5.6.0",
25
- "@huma-finance/sdk": "^0.0.77-beta.1008+fe452c1",
26
- "@huma-finance/shared": "^0.0.77-beta.1008+fe452c1",
27
- "@huma-finance/web-shared": "^0.0.77-beta.1008+fe452c1",
25
+ "@huma-finance/sdk": "^0.0.77-beta.1012+7359b01",
26
+ "@huma-finance/shared": "^0.0.77-beta.1012+7359b01",
27
+ "@huma-finance/web-shared": "^0.0.77-beta.1012+7359b01",
28
28
  "@mui/x-date-pickers": "^5.0.7",
29
29
  "@notifi-network/notifi-frontend-client": "^1.1.2",
30
30
  "@notifi-network/notifi-react": "^1.1.2",
@@ -190,5 +190,5 @@
190
190
  "optionalDependencies": {
191
191
  "encoding": "^0.1.13"
192
192
  },
193
- "gitHead": "fe452c146b76f4d39cf253ba50b8b098a3ed6fd3"
193
+ "gitHead": "7359b01105d3240483fde4190004e16b6b6810a2"
194
194
  }
@@ -59,13 +59,17 @@ export function ConfirmTransfer({
59
59
  subTitle='Withdraw all the available amount'
60
60
  >
61
61
  <Box css={styles.itemWrapper}>
62
- <Box css={styles.item}>
63
- <Box>Price Per Share</Box>
64
- <Box css={styles.itemValue}>
65
- {sharePrice.toFixed(1)} {symbol}
66
- </Box>
67
- </Box>
68
- <Divider css={styles.divider} orientation='horizontal' />
62
+ {sharePrice !== 0 && (
63
+ <>
64
+ <Box css={styles.item}>
65
+ <Box>Price Per Share</Box>
66
+ <Box css={styles.itemValue}>
67
+ {sharePrice.toFixed(1)} {symbol}
68
+ </Box>
69
+ </Box>
70
+ <Divider css={styles.divider} orientation='horizontal' />
71
+ </>
72
+ )}
69
73
  <Box css={styles.item}>
70
74
  <Box fontWeight={700}>Available to withdraw</Box>
71
75
  <Box css={styles.itemValue}>
@@ -113,7 +113,11 @@ export function SolanaLendWithdraw({
113
113
  : poolState.juniorTrancheAssets
114
114
 
115
115
  const trancheAssetsVal = new BN(trancheAssets ?? 1)
116
- const trancheSupplyVal = new BN(trancheMintAccount.supply.toString() ?? 1)
116
+ const trancheSupplyVal = new BN(
117
+ trancheMintAccount.supply.toString(),
118
+ ).isZero()
119
+ ? new BN(1)
120
+ : new BN(trancheMintAccount.supply.toString())
117
121
  const sharePrice =
118
122
  trancheAssetsVal.muln(100000).div(trancheSupplyVal).toNumber() / 100000
119
123
  setSharePrice(sharePrice)