@huma-finance/widgets 0.0.78-beta.1034 → 0.0.78-beta.1044

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.
Files changed (42) hide show
  1. package/dist/index.js +12133 -10900
  2. package/dist/src/components/Lend/solanaWithdraw/1-Option.d.ts +12 -0
  3. package/dist/src/components/Lend/solanaWithdraw/2-WithdrawAndDepositConfirm.d.ts +15 -0
  4. package/dist/src/components/Lend/solanaWithdraw/{1-ConfirmTransfer.d.ts → 3-WithdrawOnlyConfirm.d.ts} +1 -1
  5. package/dist/src/components/Lend/solanaWithdraw/4-TransferAndDeposit.d.ts +13 -0
  6. package/dist/src/components/Lend/solanaWithdraw/{3-Done.d.ts → 6-Done.d.ts} +3 -1
  7. package/dist/src/components/Lend/solanaWithdraw/components/Apy.d.ts +7 -0
  8. package/dist/src/components/Lend/solanaWithdraw/components/Benefit.d.ts +2 -0
  9. package/dist/src/components/Lend/solanaWithdraw/components/CommitSwitcher.d.ts +12 -0
  10. package/dist/src/components/Lend/solanaWithdraw/components/ModeSelector.d.ts +12 -0
  11. package/dist/src/components/Lend/solanaWithdraw/components/SelectModeTitle.d.ts +2 -0
  12. package/dist/src/components/Lend/solanaWithdraw/index.d.ts +10 -0
  13. package/dist/src/components/TxDoneModal.d.ts +1 -1
  14. package/dist/src/components/WidgetWrapper.d.ts +2 -1
  15. package/dist/src/components/icons/index.d.ts +7 -0
  16. package/dist/src/store/widgets.store.d.ts +3 -0
  17. package/package.json +5 -5
  18. package/src/components/Lend/solanaWithdraw/1-Option.tsx +180 -0
  19. package/src/components/Lend/solanaWithdraw/2-WithdrawAndDepositConfirm.tsx +208 -0
  20. package/src/components/Lend/solanaWithdraw/{1-ConfirmTransfer.tsx → 3-WithdrawOnlyConfirm.tsx} +2 -2
  21. package/src/components/Lend/solanaWithdraw/4-TransferAndDeposit.tsx +274 -0
  22. package/src/components/Lend/solanaWithdraw/{3-Done.tsx → 6-Done.tsx} +27 -3
  23. package/src/components/Lend/solanaWithdraw/components/Apy.tsx +126 -0
  24. package/src/components/Lend/solanaWithdraw/components/Benefit.tsx +63 -0
  25. package/src/components/Lend/solanaWithdraw/components/CommitSwitcher.tsx +198 -0
  26. package/src/components/Lend/solanaWithdraw/components/ModeSelector.tsx +148 -0
  27. package/src/components/Lend/solanaWithdraw/components/SelectModeTitle.tsx +61 -0
  28. package/src/components/Lend/solanaWithdraw/index.tsx +102 -12
  29. package/src/components/TxDoneModal.tsx +3 -3
  30. package/src/components/WidgetWrapper.tsx +3 -1
  31. package/src/components/icons/huma-no-empty-space.svg +15 -0
  32. package/src/components/icons/index.tsx +49 -14
  33. package/src/components/icons/minus-sign-inactive.svg +4 -0
  34. package/src/components/icons/minus-sign.svg +14 -0
  35. package/src/components/icons/mode-classic.svg +3 -0
  36. package/src/components/icons/mode-maxi.svg +3 -0
  37. package/src/components/icons/plus-sign-inactive.svg +4 -0
  38. package/src/components/icons/plus-sign.svg +14 -0
  39. package/src/hooks/useLogOnFirstMount.ts +1 -1
  40. package/src/store/widgets.store.ts +3 -0
  41. /package/dist/src/components/Lend/solanaWithdraw/{2-Transfer.d.ts → 5-Transfer.d.ts} +0 -0
  42. /package/src/components/Lend/solanaWithdraw/{2-Transfer.tsx → 5-Transfer.tsx} +0 -0
@@ -0,0 +1,12 @@
1
+ import { UnderlyingTokenInfo } from '../../../../../huma-shared/src';
2
+ import { default as React } from 'react';
3
+ import { ClaimAndStakeOption } from '.';
4
+ type Props = {
5
+ poolUnderlyingToken: UnderlyingTokenInfo;
6
+ withdrawableAmountFormatted: string | number;
7
+ selectedOption: ClaimAndStakeOption;
8
+ setSelectedOption: (option: ClaimAndStakeOption) => void;
9
+ handleConfirmOption: () => void;
10
+ };
11
+ export declare function Option({ poolUnderlyingToken, withdrawableAmountFormatted, selectedOption, setSelectedOption, handleConfirmOption, }: Props): React.ReactElement;
12
+ export {};
@@ -0,0 +1,15 @@
1
+ import { BN } from '@coral-xyz/anchor';
2
+ import { PermissionlessDepositCommitment, PermissionlessDepositMode, SolanaChainEnum } from '../../../../../huma-shared/src';
3
+ import { default as React } from 'react';
4
+ type Props = {
5
+ chainId: SolanaChainEnum;
6
+ withdrawableAmount: BN;
7
+ withdrawableAmountFormatted: string | number;
8
+ selectedDepositMode: PermissionlessDepositMode;
9
+ selectedDepositCommitment: PermissionlessDepositCommitment;
10
+ setSelectedDepositMode: (mode: PermissionlessDepositMode) => void;
11
+ setSelectedDepositCommitment: (commitment: PermissionlessDepositCommitment) => void;
12
+ withdrawAndDeposit: () => void;
13
+ };
14
+ export declare function WithdrawAndDepositConfirm({ chainId, withdrawableAmount, withdrawableAmountFormatted, selectedDepositMode, selectedDepositCommitment, setSelectedDepositMode, setSelectedDepositCommitment, withdrawAndDeposit, }: Props): React.ReactElement;
15
+ export {};
@@ -5,5 +5,5 @@ type Props = {
5
5
  withdrawableAmountFormatted: string | number;
6
6
  sharePrice: number;
7
7
  };
8
- export declare function ConfirmTransfer({ poolUnderlyingToken, withdrawableAmountFormatted, sharePrice, }: Props): React.ReactElement;
8
+ export declare function WithdrawOnlyConfirm({ poolUnderlyingToken, withdrawableAmountFormatted, sharePrice, }: Props): React.ReactElement;
9
9
  export {};
@@ -0,0 +1,13 @@
1
+ import { BN } from '@coral-xyz/anchor';
2
+ import { PermissionlessDepositCommitment, PermissionlessDepositMode, SolanaPoolInfo, TrancheType } from '../../../../../huma-shared/src';
3
+ import { default as React } from 'react';
4
+ type Props = {
5
+ poolInfo: SolanaPoolInfo;
6
+ selectedTranche: TrancheType;
7
+ poolIsClosed: boolean;
8
+ permissionlessMode: PermissionlessDepositMode;
9
+ withdrawableAmount: BN;
10
+ depositCommitment: PermissionlessDepositCommitment;
11
+ };
12
+ export declare function TransferAndDeposit({ poolInfo, selectedTranche, poolIsClosed, permissionlessMode, withdrawableAmount, depositCommitment, }: Props): React.ReactElement | null;
13
+ export {};
@@ -1,10 +1,12 @@
1
1
  import { BN } from '@coral-xyz/anchor';
2
2
  import { UnderlyingTokenInfo } from '../../../../../huma-shared/src';
3
3
  import { default as React } from 'react';
4
+ import { ClaimAndStakeOption } from '.';
4
5
  type Props = {
5
6
  poolUnderlyingToken: UnderlyingTokenInfo;
6
7
  withdrawAmount: BN;
8
+ option: ClaimAndStakeOption;
7
9
  handleAction: () => void;
8
10
  };
9
- export declare function Done({ poolUnderlyingToken, withdrawAmount, handleAction, }: Props): React.ReactElement;
11
+ export declare function Done({ poolUnderlyingToken, withdrawAmount, option, handleAction, }: Props): React.ReactElement;
10
12
  export {};
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ type Props = {
3
+ usdcApy: number | undefined;
4
+ humaRewardsApy: number | undefined;
5
+ };
6
+ export declare function Apy({ usdcApy, humaRewardsApy }: Props): React.ReactElement;
7
+ export {};
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export declare function Benefit(): React.ReactElement;
@@ -0,0 +1,12 @@
1
+ import { SerializedStyles } from '@emotion/react';
2
+ import { PermissionlessDepositCommitment } from '../../../../../../huma-shared/src';
3
+ import { ReactElement } from 'react';
4
+ interface Props {
5
+ selectedCommitment: PermissionlessDepositCommitment;
6
+ commitments: PermissionlessDepositCommitment[];
7
+ totalApy: number | undefined;
8
+ styles?: SerializedStyles;
9
+ onCommitmentChange: (commitment: PermissionlessDepositCommitment) => void;
10
+ }
11
+ export declare function CommitSwitcher({ selectedCommitment, commitments, totalApy, styles: extraStyles, onCommitmentChange, }: Props): ReactElement;
12
+ export {};
@@ -0,0 +1,12 @@
1
+ import { PermissionlessDepositMode } from '../../../../../../huma-shared/src';
2
+ import { default as React } from 'react';
3
+ type Props = {
4
+ classicModeTargetApy: number | undefined;
5
+ maxiModeTargetApy: number | undefined;
6
+ classicHumaRewardsApy: number | undefined;
7
+ maxiHumaRewardsApy: number | undefined;
8
+ selectedDepositMode: PermissionlessDepositMode;
9
+ setSelectedDepositMode: (mode: PermissionlessDepositMode) => void;
10
+ };
11
+ export declare function ModeSelector({ classicModeTargetApy, maxiModeTargetApy, classicHumaRewardsApy, maxiHumaRewardsApy, selectedDepositMode, setSelectedDepositMode, }: Props): React.ReactElement;
12
+ export {};
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export declare function SelectModeTitle(): React.ReactElement;
@@ -2,6 +2,16 @@ import { SolanaPoolInfo, TrancheType } from '../../../../../huma-shared/src';
2
2
  import { LenderStateAccount, SolanaPoolState } from '../../../../../huma-web-shared/src';
3
3
  import { default as React } from 'react';
4
4
  import { Mint } from '@solana/spl-token';
5
+ export declare enum WithdrawOption {
6
+ WITHDRAW_AND_REDEPOSIT = "withdraw-and-redeposit",
7
+ WITHDRAW_ONLY = "withdraw-only"
8
+ }
9
+ export type ClaimAndStakeOption = {
10
+ label: string;
11
+ description?: string[];
12
+ id: string;
13
+ };
14
+ export declare const ClaimAndStakeOptions: ClaimAndStakeOption[];
5
15
  /**
6
16
  * Solana lend pool withdraw props
7
17
  * @typedef {Object} SolanaLendWithdrawProps
@@ -1,6 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  type Props = {
3
- content: string[];
3
+ content: (string | React.ReactNode)[];
4
4
  subContent?: string[];
5
5
  buttonText?: string;
6
6
  handleAction: () => void;
@@ -4,8 +4,9 @@ type Props = {
4
4
  isOpen: boolean;
5
5
  isLoading?: boolean;
6
6
  loadingTitle?: string;
7
+ width?: string;
7
8
  handleClose: () => void;
8
9
  handleSuccess?: (blockNumber: number) => void;
9
10
  };
10
- export declare function WidgetWrapper({ isOpen, isLoading, loadingTitle, handleClose, handleSuccess, children, }: WCProps<Props>): React.ReactElement | null;
11
+ export declare function WidgetWrapper({ isOpen, isLoading, loadingTitle, width, handleClose, handleSuccess, children, }: WCProps<Props>): React.ReactElement | null;
11
12
  export {};
@@ -1,6 +1,7 @@
1
1
  import { SvgIconProps } from '@mui/material';
2
2
  export declare function HumaIcon(props: SvgIconProps): React.ReactElement;
3
3
  export declare function HumaFullIcon(props: SvgIconProps): React.ReactElement;
4
+ export declare function HumaNoEmptySpaceIcon(props: SvgIconProps): React.ReactElement;
4
5
  export declare function MetamaskIcon(props: SvgIconProps): React.ReactElement;
5
6
  export declare function WalletConnectIcon(props: SvgIconProps): React.ReactElement;
6
7
  export declare function EthereumIcon(props: SvgIconProps): React.ReactElement;
@@ -20,4 +21,10 @@ export declare function CeloIcon(props: SvgIconProps): React.ReactElement;
20
21
  export declare function CongratulationsIcon(props: SvgIconProps): React.ReactElement;
21
22
  export declare function RibbonIcon(props: SvgIconProps): React.ReactElement;
22
23
  export declare function HumaPointsIcon(props: SvgIconProps): React.ReactElement;
24
+ export declare function ModeClassicIcon(props: SvgIconProps): React.ReactElement;
25
+ export declare function ModeMaxiIcon(props: SvgIconProps): React.ReactElement;
26
+ export declare function MinusSignIcon(props: SvgIconProps): React.ReactElement;
27
+ export declare function PlusSignIcon(props: SvgIconProps): React.ReactElement;
28
+ export declare function MinusSignInactiveIcon(props: SvgIconProps): React.ReactElement;
29
+ export declare function PlusSignInactiveIcon(props: SvgIconProps): React.ReactElement;
23
30
  export declare function getIcon(icon: string): typeof UsdcIcon | null;
@@ -15,6 +15,9 @@ export declare enum WIDGET_STEP {
15
15
  Permit = "Permit",
16
16
  ApproveAllowance = "ApproveAllowance",
17
17
  MintNFT = "MintNFT",
18
+ Option = "Option",
19
+ ConfirmWithdrawAndDeposit = "ConfirmWithdrawAndDeposit",
20
+ ConfirmWithdrawOnly = "ConfirmWithdrawOnly",
18
21
  ConfirmTransfer = "ConfirmTransfer",
19
22
  ApproveNFT = "ApproveNFT",
20
23
  Transfer = "Transfer",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huma-finance/widgets",
3
- "version": "0.0.78-beta.1034+e02a521",
3
+ "version": "0.0.78-beta.1044+24ff73d",
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.78-beta.1034+e02a521",
26
- "@huma-finance/shared": "^0.0.78-beta.1034+e02a521",
27
- "@huma-finance/web-shared": "^0.0.78-beta.1034+e02a521",
25
+ "@huma-finance/sdk": "^0.0.78-beta.1044+24ff73d",
26
+ "@huma-finance/shared": "^0.0.78-beta.1044+24ff73d",
27
+ "@huma-finance/web-shared": "^0.0.78-beta.1044+24ff73d",
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": "e02a52193209d287a17f8af087c65928ac5a8467"
193
+ "gitHead": "24ff73d70fb62e039002e258535f1c126869f30d"
194
194
  }
@@ -0,0 +1,180 @@
1
+ import { UnderlyingTokenInfo } from '@huma-finance/shared'
2
+ import { useMQ } from '@huma-finance/web-shared'
3
+ import CheckIcon from '@mui/icons-material/Check'
4
+ import {
5
+ Box,
6
+ css,
7
+ FormControlLabel,
8
+ Radio,
9
+ RadioGroup,
10
+ useTheme,
11
+ } from '@mui/material'
12
+ import React from 'react'
13
+ import { ClaimAndStakeOption, ClaimAndStakeOptions, WithdrawOption } from '.'
14
+ import useLogOnFirstMount from '../../../hooks/useLogOnFirstMount'
15
+ import { BottomButton } from '../../BottomButton'
16
+ import { WrapperModal } from '../../WrapperModal'
17
+
18
+ type Props = {
19
+ poolUnderlyingToken: UnderlyingTokenInfo
20
+ withdrawableAmountFormatted: string | number
21
+ selectedOption: ClaimAndStakeOption
22
+ setSelectedOption: (option: ClaimAndStakeOption) => void
23
+ handleConfirmOption: () => void
24
+ }
25
+
26
+ export function Option({
27
+ poolUnderlyingToken,
28
+ withdrawableAmountFormatted,
29
+ selectedOption,
30
+ setSelectedOption,
31
+ handleConfirmOption,
32
+ }: Props): React.ReactElement {
33
+ useLogOnFirstMount('SelectWithdrawOption')
34
+ const theme = useTheme()
35
+ const { isSmSize } = useMQ()
36
+ const { symbol } = poolUnderlyingToken
37
+
38
+ const handleOptionChange = (event: React.ChangeEvent<HTMLInputElement>) => {
39
+ const option = ClaimAndStakeOptions.find(
40
+ (option) => option.id === event.target.value,
41
+ )
42
+ if (option) {
43
+ setSelectedOption(option)
44
+ }
45
+ }
46
+
47
+ const styles = {
48
+ amount: css`
49
+ display: flex;
50
+ justify-content: center;
51
+ align-items: center;
52
+ font-size: 24px;
53
+ font-weight: 700;
54
+ color: ${theme.palette.text.primary};
55
+ margin-top: ${theme.spacing(5)};
56
+ `,
57
+ radioGroup: css`
58
+ margin-top: ${theme.spacing(isSmSize ? 3 : 5)};
59
+ `,
60
+ radioButtonContainer: css`
61
+ padding: ${theme.spacing(0.125)};
62
+ border-radius: 8px;
63
+ margin-bottom: ${theme.spacing(2)};
64
+ `,
65
+ radioButton: css`
66
+ margin-bottom: ${theme.spacing(2)};
67
+ background: #1b1b1b;
68
+ width: 100%;
69
+ margin: 0;
70
+ border-radius: 8px;
71
+ padding: ${theme.spacing(2, 0.5)};
72
+ `,
73
+ radio: css`
74
+ color: ${theme.palette.text.tertiary};
75
+ `,
76
+ radioButtonActive: css`
77
+ background: linear-gradient(190deg, #d157ff 4.58%, #74deff 100%);
78
+ box-shadow: 2px 2px 24px 1px #272727;
79
+ `,
80
+ radioActive: css`
81
+ color: #c677ff !important;
82
+ `,
83
+ actionButton: css`
84
+ margin-top: ${theme.spacing(4)};
85
+ `,
86
+ description: css`
87
+ margin-top: ${theme.spacing(0.5)};
88
+ `,
89
+ descriptionList: css`
90
+ margin: 0;
91
+ padding-left: ${theme.spacing(0)};
92
+ list-style-type: none;
93
+ `,
94
+ descriptionItem: css`
95
+ display: flex;
96
+ justify-content: flex-start;
97
+ align-items: center;
98
+ margin-top: ${theme.spacing(0.5)};
99
+ line-height: 18px;
100
+ gap: ${theme.spacing(1)};
101
+ `,
102
+ checkIcon: css`
103
+ width: 16px;
104
+ height: 16px;
105
+ margin-top: 1px;
106
+ flex-shrink: 0;
107
+ color: #27db63;
108
+ `,
109
+ label: css`
110
+ font-size: 16px;
111
+ font-weight: 400;
112
+ line-height: 150%;
113
+ letter-spacing: 0.15px;
114
+ `,
115
+ descriptionText: css`
116
+ font-size: 14px;
117
+ font-weight: 400;
118
+ line-height: 150%;
119
+ letter-spacing: 0.15px;
120
+ color: #999;
121
+ `,
122
+ }
123
+
124
+ return (
125
+ <WrapperModal title={`Withdraw ${symbol}`}>
126
+ <Box css={styles.amount}>${withdrawableAmountFormatted}</Box>
127
+ <RadioGroup
128
+ value={selectedOption.id}
129
+ onChange={handleOptionChange}
130
+ css={styles.radioGroup}
131
+ >
132
+ {ClaimAndStakeOptions.map((option) => {
133
+ const isActive = selectedOption.id === option.id
134
+ return (
135
+ <Box
136
+ key={option.id}
137
+ css={[
138
+ styles.radioButtonContainer,
139
+ isActive && styles.radioButtonActive,
140
+ ]}
141
+ >
142
+ <FormControlLabel
143
+ css={styles.radioButton}
144
+ value={option.id}
145
+ control={
146
+ <Radio css={[styles.radio, isActive && styles.radioActive]} />
147
+ }
148
+ label={
149
+ <Box>
150
+ <Box css={styles.label}>{option.label}</Box>
151
+ {option.description && (
152
+ <ul css={styles.descriptionList}>
153
+ {option.description.map((description) => (
154
+ <li key={description} css={styles.descriptionItem}>
155
+ {option.id ===
156
+ WithdrawOption.WITHDRAW_AND_REDEPOSIT && (
157
+ <CheckIcon css={styles.checkIcon} />
158
+ )}
159
+ <Box component='span' css={styles.descriptionText}>
160
+ {description}
161
+ </Box>
162
+ </li>
163
+ ))}
164
+ </ul>
165
+ )}
166
+ </Box>
167
+ }
168
+ />
169
+ </Box>
170
+ )
171
+ })}
172
+ </RadioGroup>
173
+ <BottomButton variant='contained' onClick={handleConfirmOption}>
174
+ {selectedOption.id === WithdrawOption.WITHDRAW_AND_REDEPOSIT
175
+ ? 'WITHDRAW AND REDEPOSIT'
176
+ : 'WITHDRAW'}
177
+ </BottomButton>
178
+ </WrapperModal>
179
+ )
180
+ }
@@ -0,0 +1,208 @@
1
+ import { BN } from '@coral-xyz/anchor'
2
+ import {
3
+ PermissionlessDepositCommitment,
4
+ PermissionlessDepositMode,
5
+ SolanaChainEnum,
6
+ } from '@huma-finance/shared'
7
+ import { usePermissionlessApy } from '@huma-finance/web-shared'
8
+ import InfoOutlineIcon from '@mui/icons-material/InfoOutlined'
9
+ import { Box, Button, css, Divider, Tooltip, useTheme } from '@mui/material'
10
+ import React from 'react'
11
+ import useLogOnFirstMount from '../../../hooks/useLogOnFirstMount'
12
+ import { WrapperModal } from '../../WrapperModal'
13
+ import { Apy } from './components/Apy'
14
+ import { Benefit } from './components/Benefit'
15
+ import { CommitSwitcher } from './components/CommitSwitcher'
16
+ import { ModeSelector } from './components/ModeSelector'
17
+ import { SelectModeTitle } from './components/SelectModeTitle'
18
+
19
+ type Props = {
20
+ chainId: SolanaChainEnum
21
+ withdrawableAmount: BN
22
+ withdrawableAmountFormatted: string | number
23
+ selectedDepositMode: PermissionlessDepositMode
24
+ selectedDepositCommitment: PermissionlessDepositCommitment
25
+ setSelectedDepositMode: (mode: PermissionlessDepositMode) => void
26
+ setSelectedDepositCommitment: (
27
+ commitment: PermissionlessDepositCommitment,
28
+ ) => void
29
+ withdrawAndDeposit: () => void
30
+ }
31
+
32
+ export function WithdrawAndDepositConfirm({
33
+ chainId,
34
+ withdrawableAmount,
35
+ withdrawableAmountFormatted,
36
+ selectedDepositMode,
37
+ selectedDepositCommitment,
38
+ setSelectedDepositMode,
39
+ setSelectedDepositCommitment,
40
+ withdrawAndDeposit,
41
+ }: Props): React.ReactElement {
42
+ useLogOnFirstMount('ConfirmTransferAndRedeposit')
43
+ const theme = useTheme()
44
+
45
+ const {
46
+ modeTargetApy: classicModeTargetApy,
47
+ humaRewardsApy: classicHumaRewardsApy,
48
+ } = usePermissionlessApy(
49
+ chainId,
50
+ PermissionlessDepositMode.CLASSIC,
51
+ selectedDepositCommitment,
52
+ withdrawableAmount,
53
+ )
54
+ const {
55
+ modeTargetApy: maxiModeTargetApy,
56
+ humaRewardsApy: maxiHumaRewardsApy,
57
+ } = usePermissionlessApy(
58
+ chainId,
59
+ PermissionlessDepositMode.MAXI,
60
+ selectedDepositCommitment,
61
+ withdrawableAmount,
62
+ )
63
+
64
+ const styles = {
65
+ title: css`
66
+ font-weight: 400;
67
+ font-size: 20px;
68
+ color: #ececec;
69
+ font-weight: 700;
70
+ line-height: 160%;
71
+ letter-spacing: 0.15px;
72
+ margin-top: ${theme.spacing(-1)};
73
+ `,
74
+ description: css`
75
+ font-weight: 400;
76
+ font-size: 14px;
77
+ color: #999;
78
+ margin-top: ${theme.spacing(1)};
79
+ `,
80
+ availableToWithdraw: css`
81
+ display: flex;
82
+ justify-content: space-between;
83
+ align-items: center;
84
+ margin-top: ${theme.spacing(1)};
85
+ font-weight: 400;
86
+ font-size: 16px;
87
+ color: #999;
88
+ background: #1b1b1b;
89
+ padding: ${theme.spacing(2)};
90
+ border-radius: 8px;
91
+ height: 60px;
92
+ `,
93
+ availableToWithdrawTitle: css`
94
+ font-weight: 500;
95
+ font-size: 16px;
96
+ color: #b8b8b8;
97
+ `,
98
+ availableToWithdrawAmount: css`
99
+ font-size: 24px;
100
+ font-weight: 700;
101
+ color: #ececec;
102
+ `,
103
+ selectDepositMode: css`
104
+ display: flex;
105
+ justify-content: flex-start;
106
+ align-items: center;
107
+ margin-top: ${theme.spacing(3)};
108
+ gap: ${theme.spacing(0.5)};
109
+ `,
110
+ selectDepositModeTitle: css`
111
+ font-weight: 700;
112
+ font-size: 16px;
113
+ color: #b8b8b8;
114
+ `,
115
+ infoIcon: css`
116
+ width: 16px;
117
+ height: 16px;
118
+ color: #686868;
119
+ `,
120
+ lockupTitle: css`
121
+ display: flex;
122
+ align-items: center;
123
+ gap: ${theme.spacing(0.5)};
124
+ color: #b8b8b8;
125
+ font-size: 16px;
126
+ font-weight: 700;
127
+ line-height: 150%;
128
+ letter-spacing: 0.15px;
129
+ margin-top: ${theme.spacing(2)};
130
+ `,
131
+ commitSwitcher: css`
132
+ margin-top: ${theme.spacing(2)};
133
+ `,
134
+ divider: css`
135
+ margin-top: ${theme.spacing(2)};
136
+ border-color: #222;
137
+ `,
138
+ buttonContainer: css`
139
+ width: 100%;
140
+ margin-top: ${theme.spacing(2)};
141
+
142
+ button {
143
+ width: 100%;
144
+ }
145
+ `,
146
+ }
147
+
148
+ return (
149
+ <WrapperModal title=''>
150
+ <Box css={styles.title}>Withdraw and redeposit to Permissionless</Box>
151
+ <Box css={styles.availableToWithdraw}>
152
+ <Box css={styles.availableToWithdrawTitle}>Available to withdraw</Box>
153
+ <Box css={styles.availableToWithdrawAmount}>
154
+ ${withdrawableAmountFormatted}
155
+ </Box>
156
+ </Box>
157
+ <SelectModeTitle />
158
+ <ModeSelector
159
+ classicModeTargetApy={classicModeTargetApy}
160
+ maxiModeTargetApy={maxiModeTargetApy}
161
+ classicHumaRewardsApy={classicHumaRewardsApy}
162
+ maxiHumaRewardsApy={maxiHumaRewardsApy}
163
+ selectedDepositMode={selectedDepositMode}
164
+ setSelectedDepositMode={setSelectedDepositMode}
165
+ />
166
+ <Box css={styles.lockupTitle}>
167
+ <Box>Lockup to earn more yield</Box>
168
+ <Tooltip
169
+ title='Rewards are based on your engagement with the Huma protocol.'
170
+ placement='top'
171
+ >
172
+ <InfoOutlineIcon css={styles.infoIcon} />
173
+ </Tooltip>
174
+ </Box>
175
+ <Box css={styles.commitSwitcher}>
176
+ <CommitSwitcher
177
+ selectedCommitment={selectedDepositCommitment}
178
+ commitments={Object.values(PermissionlessDepositCommitment)}
179
+ totalApy={
180
+ selectedDepositMode === PermissionlessDepositMode.CLASSIC
181
+ ? (classicModeTargetApy ?? 0) + (classicHumaRewardsApy ?? 0)
182
+ : (maxiModeTargetApy ?? 0) + (maxiHumaRewardsApy ?? 0)
183
+ }
184
+ onCommitmentChange={setSelectedDepositCommitment}
185
+ />
186
+ </Box>
187
+ <Divider css={styles.divider} />
188
+ <Apy
189
+ usdcApy={
190
+ selectedDepositMode === PermissionlessDepositMode.CLASSIC
191
+ ? classicModeTargetApy
192
+ : maxiModeTargetApy
193
+ }
194
+ humaRewardsApy={
195
+ selectedDepositMode === PermissionlessDepositMode.CLASSIC
196
+ ? classicHumaRewardsApy
197
+ : maxiHumaRewardsApy
198
+ }
199
+ />
200
+ <Box css={styles.buttonContainer}>
201
+ <Button variant='contained' onClick={withdrawAndDeposit}>
202
+ WITHDRAW AND DEPOSIT
203
+ </Button>
204
+ </Box>
205
+ <Benefit />
206
+ </WrapperModal>
207
+ )
208
+ }
@@ -2,11 +2,11 @@ import { UnderlyingTokenInfo } from '@huma-finance/shared'
2
2
  import { Box, Divider, css, useTheme } from '@mui/material'
3
3
  import React from 'react'
4
4
  import { useDispatch } from 'react-redux'
5
+ import useLogOnFirstMount from '../../../hooks/useLogOnFirstMount'
5
6
  import { setStep } from '../../../store/widgets.reducers'
6
7
  import { WIDGET_STEP } from '../../../store/widgets.store'
7
8
  import { BottomButton } from '../../BottomButton'
8
9
  import { WrapperModal } from '../../WrapperModal'
9
- import useLogOnFirstMount from '../../../hooks/useLogOnFirstMount'
10
10
 
11
11
  type Props = {
12
12
  poolUnderlyingToken: UnderlyingTokenInfo
@@ -14,7 +14,7 @@ type Props = {
14
14
  sharePrice: number
15
15
  }
16
16
 
17
- export function ConfirmTransfer({
17
+ export function WithdrawOnlyConfirm({
18
18
  poolUnderlyingToken,
19
19
  withdrawableAmountFormatted,
20
20
  sharePrice,