Skip to content

Commit

Permalink
fix: V3 speedlist
Browse files Browse the repository at this point in the history
  • Loading branch information
paintoshi committed Jan 8, 2025
1 parent 309abb3 commit 7efaa9b
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const Home: NextPage = () => {
const [startTime, setStartTime] = useState<number>(0)
const [isMinting, setIsMinting] = useState(false)
const [txSpeedsState, setTxSpeedsState] = useState<SpeedList[]>(nullSpeed)
const [txSpeeds, setTxSpeeds] = usePersistState<SpeedList[]>(nullSpeed, 'txSpeedHistoryV2')
const [txSpeeds, setTxSpeeds] = usePersistState<SpeedList[]>(nullSpeed, 'txSpeedHistoryV3')
const [latestMintedBlockNumber0Conf, setLatestMintedBlockNumber0Conf] = useState<number>(0)
const [resetKey, setResetKey] = useState(0)
const [scrollToLatest, setScrollToLatest] = useState(false)
Expand Down Expand Up @@ -254,25 +254,6 @@ const Home: NextPage = () => {
}
}, [txSpeeds])

// If txSpeeds contains chainId 57054, move the content of 57054 to 146 and remove 57054
useEffect(() => {
// Store the content of chainId 57054
const sonicChain = txSpeeds.find((x) => x.chainId === 57054)
if (sonicChain) {
// Exclude chainId 57054
const newTxSpeeds = txSpeeds.filter((x) => x.chainId !== 57054)
// Replace chainId 146 with the content of 57054
const newList = newTxSpeeds.map((x) => {
if (x.chainId === 146) {
x.speed = sonicChain.speed
x.average = sonicChain.average
}
return x
})
setTxSpeeds(newList)
}
}, [txSpeeds, setTxSpeeds])

// Reset everything when the network changes
useEffect(() => {
if (chain?.id && chain?.id !== networkValue) {
Expand Down

0 comments on commit 7efaa9b

Please sign in to comment.