-
Notifications
You must be signed in to change notification settings - Fork 207
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
Pectra Validator EL Actions #724
Merged
wackerow
merged 11 commits into
ethereum:pectra
from
valefar-on-discord:validator-consolidation
Jan 30, 2025
Merged
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f1c364e
Wallet connect/Query validators/Differentiate/Send TX
valefar-on-discord 226d0b9
feat: add ui Select component
wackerow 1624bdd
feat: implement ui Select component on Actions
wackerow 697517e
Generalize NumberInput
valefar-on-discord 6d5c43c
Adding validator consolidation flow
valefar-on-discord 645239c
feat: expand Select functionality
wackerow 2442c83
Integrating with compounding/withdrawal contract for consolidation an…
valefar-on-discord 2622dc2
Change Actions api to search by withdrawal address
valefar-on-discord 0f654da
fix: executionLayerName destructuring
wackerow 01d421e
test: use devnet5 in netlify toml
wackerow feb4bdb
Merge branch 'pectra' into pr/724
wackerow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
import React, { useState, useRef, useEffect } from 'react'; | ||
import { useIntl } from 'react-intl'; | ||
import styled from 'styled-components'; | ||
import { Checkmark, FormDown, FormUp } from 'grommet-icons'; | ||
|
||
const Container = styled.div` | ||
position: relative; | ||
width: 100%; | ||
max-width: 380px; | ||
`; | ||
|
||
const Trigger = styled.div` | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
padding: 0.5rem 1rem; | ||
border: 1px solid #ccc; | ||
background-color: #fff; | ||
cursor: pointer; | ||
`; | ||
|
||
const Content = styled.div` | ||
position: absolute; | ||
top: 100%; | ||
inset-inline: 0; | ||
background-color: #fff; | ||
border: 1px solid #ccc; | ||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | ||
max-height: 200px; | ||
overflow-y: auto; | ||
z-index: 1000; | ||
`; | ||
|
||
const Item = styled.div` | ||
padding: 0.5rem 1rem; | ||
cursor: pointer; | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
gap: 0.75rem; | ||
|
||
&:hover { | ||
background-color: #f0f0f0; | ||
} | ||
|
||
&[data-selected='true'] { | ||
background-color: #e0e0e0; | ||
} | ||
`; | ||
|
||
const SearchInput = styled.input` | ||
width: 100%; | ||
padding: 0.5rem 1rem; | ||
border: none; | ||
border-bottom: 1px solid #ccc; | ||
outline: none; | ||
`; | ||
|
||
export type Option = { | ||
value: string; | ||
} & ( | ||
| { | ||
label: string; | ||
searchContext?: string; | ||
} | ||
| { | ||
label: React.ReactNode; | ||
searchContext: string; | ||
} | ||
); | ||
|
||
export type SelectProps = { | ||
options: Option[]; | ||
value: string; | ||
onChange: (value: string) => void; | ||
placeholder?: string; | ||
searchPlaceholder?: string; | ||
}; | ||
|
||
const Select = ({ | ||
options, | ||
value, | ||
onChange, | ||
placeholder, | ||
searchPlaceholder, | ||
}: SelectProps) => { | ||
const { formatMessage } = useIntl(); | ||
const [isOpen, setIsOpen] = useState(false); | ||
const [search, setSearch] = useState(''); | ||
const containerRef = useRef<HTMLDivElement>(null); | ||
|
||
const handleSelect = (choice: string) => { | ||
onChange(choice); | ||
setIsOpen(false); | ||
setSearch(''); | ||
}; | ||
|
||
const handleClickOutside = (event: MouseEvent) => { | ||
if ( | ||
containerRef.current && | ||
!containerRef.current.contains(event.target as Node) | ||
) { | ||
setIsOpen(false); | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
document.addEventListener('mousedown', handleClickOutside); | ||
return () => { | ||
document.removeEventListener('mousedown', handleClickOutside); | ||
}; | ||
}, []); | ||
|
||
const selectedOption = options.find(option => option.value === value); | ||
|
||
const filteredOptions = options.filter(option => { | ||
const hasSearchContext = 'searchContext' in option; | ||
const hasStringLabel = typeof option.label === 'string'; | ||
let fullSearchContext: string; | ||
|
||
if (hasStringLabel && hasSearchContext) { | ||
fullSearchContext = `${option.searchContext}${option.label}`; | ||
} else if (hasSearchContext) { | ||
fullSearchContext = option.searchContext!; | ||
} else { | ||
fullSearchContext = option.label as string; | ||
} | ||
return fullSearchContext.toLowerCase().includes(search.toLowerCase()); | ||
}); | ||
|
||
return ( | ||
<Container ref={containerRef}> | ||
<Trigger onClick={() => setIsOpen(!isOpen)}> | ||
<span>{selectedOption?.label || placeholder}</span> | ||
{isOpen ? <FormUp /> : <FormDown />} | ||
</Trigger> | ||
{isOpen && ( | ||
<Content> | ||
<SearchInput | ||
type="text" | ||
value={search} | ||
onChange={e => setSearch(e.target.value)} | ||
placeholder={ | ||
searchPlaceholder || | ||
formatMessage({ defaultMessage: 'Type to filter' }) | ||
} | ||
/> | ||
{filteredOptions.map(option => ( | ||
<Item | ||
key={option.value} | ||
data-selected={option.value === value} | ||
onClick={() => handleSelect(option.value)} | ||
> | ||
{option.label} | ||
<Checkmark | ||
style={{ | ||
fill: '#26AB83', | ||
visibility: option.value === value ? 'visible' : 'hidden', | ||
}} | ||
/> | ||
</Item> | ||
))} | ||
</Content> | ||
)} | ||
</Container> | ||
); | ||
}; | ||
|
||
export default Select; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './TransactionStatusModal'; | ||
export * from './TransactionProgress'; | ||
export * from './types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export type TransactionStatus = | ||
| 'not_started' | ||
| 'waiting_user_confirmation' | ||
| 'user_rejected' | ||
| 'confirm_on_chain' | ||
| 'error' | ||
| 'success'; | ||
|
||
export type stepStatus = 'loading' | 'staged' | 'complete' | 'error'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 already a dependency it is now just explicit