-
Notifications
You must be signed in to change notification settings - Fork 47
feat: Add UI and hooks for pre-deposit functionality #816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat/wallet-connect
Are you sure you want to change the base?
feat: Add UI and hooks for pre-deposit functionality #816
Conversation
- Added useApprovePreDepositToken hook for token approval process. - Implemented useExchangeRate hook to fetch token exchange rates from Binance. - Developed useMaxPreDepositValue hook to read maximum deposit amount for a user. - Introduced usePreDepositStateContext and usePreDepositStateMachine for managing pre-deposit state. - Created usePreDepositVault hook for depositing tokens into a vault. - Updated DashboardPage to include vault selection and pre-deposit modal.
|
|
@gbonumore is attempting to deploy a commit to the Status Team on Vercel. A member of the Team first needs to authorize it. |
| const { name, apy, rewards, icon, onDeposit } = props | ||
| const apyValue = apy.endsWith('%') ? apy.slice(0, -1) : apy | ||
| const rewardsLine = rewards.join(', ') | ||
| const rewardsLine = rewards.map(reward => reward.name).join(', ') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are the chances that reward.name is not undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is defined by us, since it's required this would not compile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good, just some magic numbers.
Also an open question but why don't we use SVGs for icons?
| .with({ exchangeRate: P.nullish }, () => 0) | ||
| .with({ amountInputNumber: P.when(n => isNaN(n) || n <= 0) }, () => 0) | ||
| .with({ calculatedUSD: P.when(n => !isFinite(n)) }, () => null) | ||
| .with({ calculatedUSD: P.when(n => n > 1_000_000_000_000) }, () => null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There must be a good reason but why 1_000_000_000_000 specifically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to avoid insanely dollar values and do useless api calls, so this check might not be even here (this is more or less the same UX swap protocols offer when you try to input unreal money) feel free to change this number to a fair value that doesn't break UI or directly on the API call to prevent the call to be fired
| enabled, | ||
| refetchInterval, | ||
| staleTime, | ||
| retry: 3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
magic number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is indeed you might want to setup default retries on the queryclient config
| options: Omit<FormatTokenOptions, 'tokenDecimals'> = {} | ||
| ): string { | ||
| return formatTokenAmount(amount, 'ETH', { | ||
| decimals: 4, // Default to 4 decimals for ETH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
magic number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file comes from #811 so you guys want to address these on that PR first
| ): string { | ||
| return formatTokenAmount(amount, 'KARMA', { | ||
| ...options, | ||
| tokenDecimals: 0, // KARMA values are already in display units |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
magic number
| ): string { | ||
| const { | ||
| currency = 'USD', | ||
| tokenDecimals = 0, // Default to 0 for currency values (already in display units) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
magic number
Co-authored-by: Onuwa Nnachi Isaac <[email protected]>
Co-authored-by: Onuwa Nnachi Isaac <[email protected]>
Co-authored-by: Onuwa Nnachi Isaac <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
App is not building anymore due to mismatching types names
closes #775