Skip to content

Commit 89b44c0

Browse files
rickimooreantondlr
authored andcommitted
Feat: Enable Deposits (#268)
Co-authored-by: antondlr <[email protected]>
1 parent 45d6ec3 commit 89b44c0

File tree

10 files changed

+540
-64
lines changed

10 files changed

+540
-64
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ developers. Specifically the [Lighthouse UI](https://lighthouse-book.sigmaprime.
2121

2222
### Docker (Recommended)
2323

24-
Docker is the recommended way to run Siren. This will expose Siren as a webapp.
24+
Docker is the recommended way to run Siren. This will expose Siren as a webapp.
2525

2626
`docker` is required to be installed with the service running.
2727

@@ -113,21 +113,20 @@ the background and can be accessed via their local http APIs.
113113

114114
### Docker
115115

116-
### Docker
116+
### Docker
117117

118118
The docker image can be built with the following command:
119119
`docker build -f Dockerfile -t siren .`
120120

121121
### Building locally
122122

123123
#### Build and run the backend
124-
Navigate to the backend directory `cd backend`. Install all required Node packages by running `yarn`. Once the installation is complete, compile the backend with `yarn build`. Deploy the backend in a production environment, `yarn start:production`. This ensures optimal performance.
125124

125+
Navigate to the backend directory `cd backend`. Install all required Node packages by running `yarn`. Once the installation is complete, compile the backend with `yarn build`. Deploy the backend in a production environment, `yarn start:production`. This ensures optimal performance.
126126

127127
Navigate to the backend directory `cd backend`. Install all required Node packages by running `yarn`. Once the installation is complete, compile the backend with `yarn build`. Deploy the backend in a production environment, `yarn start:production`. This ensures optimal performance.
128128

129129
#### Build and run the frontend
130-
After initializing the backend, return to the root directory. Install all frontend dependencies by executing `yarn`. Build the frontend using `yarn build`. Start the frontend production server with `yarn start`.
131130

132131
After initializing the backend, return to the root directory. Install all frontend dependencies by executing `yarn`. Build the frontend using `yarn build`. Start the frontend production server with `yarn start`.
133132

app/dashboard/settings/Main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'use client';
1+
'use client'
22

33
import axios from 'axios'
44
import { useRouter } from 'next/navigation'

backend/yarn.lock

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5472,16 +5472,7 @@ string-length@^4.0.1:
54725472
char-regex "^1.0.2"
54735473
strip-ansi "^6.0.0"
54745474

5475-
"string-width-cjs@npm:string-width@^4.2.0":
5476-
version "4.2.3"
5477-
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
5478-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
5479-
dependencies:
5480-
emoji-regex "^8.0.0"
5481-
is-fullwidth-code-point "^3.0.0"
5482-
strip-ansi "^6.0.1"
5483-
5484-
"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
5475+
"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
54855476
version "4.2.3"
54865477
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
54875478
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -5513,14 +5504,7 @@ string_decoder@~1.1.1:
55135504
dependencies:
55145505
safe-buffer "~5.1.0"
55155506

5516-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
5517-
version "6.0.1"
5518-
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
5519-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
5520-
dependencies:
5521-
ansi-regex "^5.0.1"
5522-
5523-
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
5507+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
55245508
version "6.0.1"
55255509
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
55265510
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -6069,7 +6053,7 @@ wkx@^0.5.0:
60696053
dependencies:
60706054
"@types/node" "*"
60716055

6072-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
6056+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
60736057
version "7.0.0"
60746058
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
60756059
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -6087,15 +6071,6 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0:
60876071
string-width "^4.1.0"
60886072
strip-ansi "^6.0.0"
60896073

6090-
wrap-ansi@^7.0.0:
6091-
version "7.0.0"
6092-
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
6093-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
6094-
dependencies:
6095-
ansi-styles "^4.0.0"
6096-
string-width "^4.1.0"
6097-
strip-ansi "^6.0.0"
6098-
60996074
wrap-ansi@^8.1.0:
61006075
version "8.1.0"
61016076
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"

src/components/AlertInfo/AlertInfo.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ const AlertInfo: FC<AlertInfoProps> = ({ priorityLogs, ...props }) => {
2626
const duties = useRecoilValue(proposerDuties)
2727

2828
const priorityLogAlerts = useMemo(() => {
29-
return Object.values(metrics).flat().filter(({level}) =>
30-
level === LogLevels.CRIT || level === LogLevels.ERRO)
31-
.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
32-
}, [metrics]);
29+
return Object.values(metrics)
30+
.flat()
31+
.filter(({ level }) => level === LogLevels.CRIT || level === LogLevels.ERRO)
32+
.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime())
33+
}, [metrics])
3334

3435
const setFilterValue = (value: FilterValue) => setFilter(value)
3536
const isMobile = useMediaQuery('(max-width: 425px)')

src/components/AuthPrompt/AuthPrompt.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export interface AuthModalProps extends Omit<AuthFormProps, 'children'> {
1515
isLoading: boolean
1616
onClose?: () => void
1717
mode: UiMode
18-
maxHeight?: string
1918
}
2019

2120
const AuthPrompt: FC<AuthModalProps> = ({ onSubmit, isVisible, isLoading, mode, onClose }) => {
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import Link, { LinkProps } from 'next/link'
2+
import { FC } from 'react'
3+
import Typography, { TypographyProps } from '../Typography/Typography'
4+
5+
export interface ExternalLinkProps
6+
extends Omit<LinkProps, 'as'>,
7+
Omit<TypographyProps, 'children' | 'as'> {
8+
text: string
9+
}
10+
11+
const ExternalLink: FC<ExternalLinkProps> = ({
12+
href,
13+
text,
14+
color = 'text-dark400',
15+
type = 'text-caption1',
16+
...props
17+
}) => {
18+
return (
19+
<div>
20+
<Link href={href} target='_blank' passHref>
21+
<div className='flex space-x-2 items-center'>
22+
<Typography color={color} type={type} className='underline' {...props}>
23+
{text}
24+
</Typography>
25+
<i className='text-dark400 text-caption1 bi-box-arrow-up-right' />
26+
</div>
27+
</Link>
28+
</div>
29+
)
30+
}
31+
32+
export default ExternalLink
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import { FC, ReactNode } from 'react'
2+
import { useTranslation } from 'react-i18next'
3+
import { useRecoilState } from 'recoil'
4+
import useWalletConnection from '../../hooks/useWalletConnection'
5+
import { isWalletConnectModal } from '../../recoil/atoms'
6+
import Button, { ButtonFace } from '../Button/Button'
7+
import Typography, { TypographyType } from '../Typography/Typography'
8+
9+
export interface WalletActionBtnProps {
10+
children: ReactNode
11+
textSize?: TypographyType | undefined
12+
isSufficientBalance?: boolean
13+
}
14+
15+
const WalletActionBtn: FC<WalletActionBtnProps> = ({
16+
children,
17+
textSize,
18+
isSufficientBalance = true,
19+
}) => {
20+
const { t } = useTranslation()
21+
const { isConnected, isValidNetwork, switchNetwork } = useWalletConnection()
22+
const [isOpen, setIsOpen] = useRecoilState(isWalletConnectModal)
23+
const openModal = () => setIsOpen(true)
24+
25+
const renderButton = () => {
26+
switch (true) {
27+
case !isConnected:
28+
return (
29+
<Button
30+
className='w-full h-full'
31+
isLoading={isOpen}
32+
onClick={openModal}
33+
type={ButtonFace.SECONDARY}
34+
>
35+
<Typography color='text-white' type={textSize} darkMode='dark:text-white'>
36+
{t('connect')}
37+
</Typography>
38+
</Button>
39+
)
40+
case !isValidNetwork:
41+
return (
42+
<Button className='w-full h-full' onClick={switchNetwork} type={ButtonFace.ERROR}>
43+
<Typography
44+
color='text-error'
45+
type={textSize}
46+
darkMode='dark:text-error'
47+
className='break-keep whitespace-nowrap'
48+
>
49+
{t('switchNetwork')}
50+
</Typography>
51+
</Button>
52+
)
53+
case !isSufficientBalance:
54+
return (
55+
<Button className='w-full h-full' isDisabled type={ButtonFace.ERROR}>
56+
<Typography
57+
color='text-error'
58+
type={textSize}
59+
darkMode='dark:text-error'
60+
className='break-keep whitespace-nowrap'
61+
>
62+
{t('insufficientFunds')}
63+
</Typography>
64+
</Button>
65+
)
66+
default:
67+
return children
68+
}
69+
}
70+
71+
return renderButton()
72+
}
73+
74+
export default WalletActionBtn

src/types/beacon.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export type ValidatorMetricResult = {
4141
}
4242

4343
export type ValidatorMetricResult = {
44-
targetEffectiveness: number,
45-
hitEffectiveness: number,
44+
targetEffectiveness: number
45+
hitEffectiveness: number
4646
totalEffectiveness: number
4747
}

src/types/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,18 @@ export type Metric = {
5858

5959
export type LogData = {
6060
id: number
61-
level: LogLevels,
62-
type: LogType,
61+
level: LogLevels
62+
type: LogType
6363
data: string
64-
isHidden: boolean,
64+
isHidden: boolean
6565
createdAt: string
6666
updatedAt: string
6767
}
6868

6969
export type LogMetric = {
70-
warningLogs: LogData[],
71-
errorLogs: LogData[],
72-
criticalLogs: LogData[],
70+
warningLogs: LogData[]
71+
errorLogs: LogData[]
72+
criticalLogs: LogData[]
7373
}
7474

7575
export enum LogType {

0 commit comments

Comments
 (0)