@huma-finance/widgets 0.0.62-beta.621 → 0.0.62-beta.624

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huma-finance/widgets",
3
- "version": "0.0.62-beta.621+60c42c2",
3
+ "version": "0.0.62-beta.624+f049d3f",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -28,9 +28,9 @@
28
28
  "@ethersproject/experimental": "^5.7.0",
29
29
  "@ethersproject/providers": "^5.6.0",
30
30
  "@ethersproject/units": "^5.6.0",
31
- "@huma-finance/sdk": "^0.0.62-beta.621+60c42c2",
32
- "@huma-finance/shared": "^0.0.62-beta.621+60c42c2",
33
- "@huma-finance/web-shared": "^0.0.62-beta.621+60c42c2",
31
+ "@huma-finance/sdk": "^0.0.62-beta.624+f049d3f",
32
+ "@huma-finance/shared": "^0.0.62-beta.624+f049d3f",
33
+ "@huma-finance/web-shared": "^0.0.61",
34
34
  "@notifi-network/notifi-frontend-client": "^0.91.1",
35
35
  "@reduxjs/toolkit": "^1.8.6",
36
36
  "@types/utf8": "^3.0.1",
@@ -200,5 +200,5 @@
200
200
  "optionalDependencies": {
201
201
  "encoding": "^0.1.13"
202
202
  },
203
- "gitHead": "60c42c211d6cf4955f969c8aea9fbabd3ef09df4"
203
+ "gitHead": "f049d3fcb4016bc93586525dfcf8b69b9aa9d9d6"
204
204
  }
@@ -24,11 +24,13 @@ import { Transfer } from './3-Transfer'
24
24
  * @typedef {Object} SolanaLendAddRedemptionProps
25
25
  * @property {SolanaPoolInfo} poolInfo The metadata of the pool.
26
26
  * @property {SolanaPoolState} poolState The current state config of the pool. * @property {function():void} handleClose Function to notify to close the widget modal when user clicks the 'x' close button.
27
+ * @property {POOL_NTrancheTypeAME} tranche The tranche type.
27
28
  * @property {function():void|undefined} handleSuccess Optional function to notify that the lending pool supply action is successful.
28
29
  */
29
30
  export interface SolanaLendAddRedemptionProps {
30
31
  poolInfo: SolanaPoolInfo
31
32
  poolState: SolanaPoolState
33
+ tranche?: TrancheType
32
34
  handleClose: () => void
33
35
  handleSuccess?: () => void
34
36
  }
@@ -36,6 +38,7 @@ export interface SolanaLendAddRedemptionProps {
36
38
  export function SolanaLendAddRedemption({
37
39
  poolInfo,
38
40
  poolState,
41
+ tranche,
39
42
  handleClose,
40
43
  handleSuccess,
41
44
  }: SolanaLendAddRedemptionProps): React.ReactElement | null {
@@ -51,7 +54,9 @@ export function SolanaLendAddRedemption({
51
54
  loading: isLoadingTokenAccounts,
52
55
  } = useTrancheTokenAccounts(poolInfo)
53
56
  const { step, errorMessage } = useAppSelector(selectWidgetState)
54
- const [selectedTranche, setSelectedTranche] = useState<TrancheType>()
57
+ const [selectedTranche, setSelectedTranche] = useState<
58
+ TrancheType | undefined
59
+ >(tranche)
55
60
 
56
61
  useEffect(() => {
57
62
  if (!step && !isLoadingLenderAccounts && !isLoadingTokenAccounts) {
@@ -62,6 +67,11 @@ export function SolanaLendAddRedemption({
62
67
  juniorTokenAccount?.amount?.toString() ?? 0,
63
68
  )
64
69
 
70
+ if (selectedTranche) {
71
+ dispatch(setStep(WIDGET_STEP.ChooseAmount))
72
+ return
73
+ }
74
+
65
75
  if (juniorTrancheShares.gtn(0) && seniorTrancheShares.lten(0)) {
66
76
  setSelectedTranche('junior')
67
77
  dispatch(setStep(WIDGET_STEP.ChooseAmount))
@@ -85,6 +95,7 @@ export function SolanaLendAddRedemption({
85
95
  isLoadingTokenAccounts,
86
96
  seniorTokenAccount?.amount,
87
97
  juniorTokenAccount?.amount,
98
+ selectedTranche,
88
99
  ])
89
100
 
90
101
  const title = 'Redemption'
@@ -22,7 +22,7 @@ export function SolanaViewOnExplorer({
22
22
  }
23
23
 
24
24
  return (
25
- <Button fullWidth variant='contained' onClick={() => openInNewTab(link)}>
25
+ <Button fullWidth variant='outlined' onClick={() => openInNewTab(link)}>
26
26
  <Box component='span'>VIEW ON EXPLORER</Box>
27
27
  </Button>
28
28
  )