@@ -16,13 +16,13 @@ import {
16
16
Tooltip ,
17
17
Typography ,
18
18
} from '@mui/material' ;
19
- import { chainIdToChain , toChainId } from '@wormhole-foundation/sdk-base' ;
19
+ import { ChainId , chainIdToChain } from '@wormhole-foundation/sdk-base' ;
20
20
import {
21
21
MISS_THRESHOLD_LABEL ,
22
22
explorerBlock ,
23
23
explorerTx ,
24
24
explorerVaa ,
25
- getMissThreshold
25
+ getMissThreshold ,
26
26
} from '@wormhole-foundation/wormhole-monitor-common' ;
27
27
import axios from 'axios' ;
28
28
import { useCallback , useEffect , useMemo , useState } from 'react' ;
@@ -78,7 +78,7 @@ function BlockDetail({ chain, message }: { chain: string; message: ObservedMessa
78
78
gutterBottom
79
79
>
80
80
< IconButton
81
- href = { explorerTx ( network , toChainId ( Number ( chain ) ) , message . txHash ) }
81
+ href = { explorerTx ( network , Number ( chain ) as ChainId , message . txHash ) }
82
82
target = "_blank"
83
83
size = "small"
84
84
sx = { inlineIconButtonSx }
@@ -106,7 +106,7 @@ function BlockDetail({ chain, message }: { chain: string; message: ObservedMessa
106
106
< Typography gutterBottom >
107
107
Block { message . block } { ' ' }
108
108
< IconButton
109
- href = { explorerBlock ( network , toChainId ( Number ( chain ) ) , message . block . toString ( ) ) }
109
+ href = { explorerBlock ( network , Number ( chain ) as ChainId , message . block . toString ( ) ) }
110
110
target = "_blank"
111
111
size = "small"
112
112
sx = { inlineIconButtonSx }
@@ -240,7 +240,7 @@ function ReobserveCodeContent({ misses }: { misses: MissesByChain }) {
240
240
. map ( ( [ chain , info ] ) => {
241
241
const filteredMisses = showAllMisses
242
242
? info . messages
243
- : info . messages . filter ( ( message ) => message . timestamp < getMissThreshold ( now , toChainId ( Number ( chain ) ) ) ) ;
243
+ : info . messages . filter ( ( message ) => message . timestamp < getMissThreshold ( now , chain ) ) ;
244
244
return filteredMisses . length === 0
245
245
? null
246
246
: filteredMisses
@@ -295,7 +295,7 @@ function Misses({
295
295
const filteredMisses = showAllMisses
296
296
? info . messages
297
297
: info . messages
298
- . filter ( ( message ) => message . timestamp < getMissThreshold ( now , toChainId ( Number ( chain ) ) ) )
298
+ . filter ( ( message ) => message . timestamp < getMissThreshold ( now , chain ) )
299
299
. filter (
300
300
( message ) =>
301
301
! governorInfo ?. enqueuedVAAs . some (
@@ -309,7 +309,7 @@ function Misses({
309
309
< CollapsibleSection
310
310
key = { chain }
311
311
defaultExpanded = { false }
312
- header = { `${ chainIdToChain . get ( toChainId ( Number ( chain ) ) ) } (${ chain } ) - ${
312
+ header = { `${ chainIdToChain . get ( Number ( chain ) as ChainId ) } (${ chain } ) - ${
313
313
filteredMisses . length
314
314
} `}
315
315
>
@@ -385,7 +385,7 @@ function Monitor({ governorInfo }: { governorInfo?: CloudGovernorInfo | null })
385
385
const filteredMisses = showAllMisses
386
386
? info . messages
387
387
: info . messages
388
- . filter ( ( message ) => message . timestamp < getMissThreshold ( now , toChainId ( Number ( chain ) ) ) )
388
+ . filter ( ( message ) => message . timestamp < getMissThreshold ( now , chain ) )
389
389
. filter (
390
390
( message ) =>
391
391
! governorInfo ?. enqueuedVAAs . some (
@@ -397,7 +397,7 @@ function Monitor({ governorInfo }: { governorInfo?: CloudGovernorInfo | null })
397
397
) ;
398
398
return filteredMisses . length === 0
399
399
? counts
400
- : { ...counts , [ toChainId ( Number ( chain ) ) ] : filteredMisses . length } ;
400
+ : { ...counts , [ Number ( chain ) as ChainId ] : filteredMisses . length } ;
401
401
} , { } )
402
402
: { } ;
403
403
} , [ governorInfo ?. enqueuedVAAs , misses , showAllMisses ] ) ;
@@ -499,14 +499,14 @@ function Monitor({ governorInfo }: { governorInfo?: CloudGovernorInfo | null })
499
499
header = {
500
500
< div >
501
501
< Typography variant = "h5" sx = { { mb : 0.5 } } >
502
- { chainIdToChain . get ( toChainId ( Number ( chain ) ) ) } ({ chain } )
502
+ { chainIdToChain . get ( Number ( chain ) as ChainId ) } ({ chain } )
503
503
</ Typography >
504
504
< Typography variant = "body2" sx = { { mb : 0.5 } } >
505
505
Last Indexed Block - { lastBlock . split ( '/' ) [ 0 ] }
506
506
{ ' - ' }
507
507
{ new Date ( lastBlock . split ( '/' ) [ 1 ] ) . toLocaleString ( ) }
508
508
</ Typography >
509
- { messageCounts ?. [ toChainId ( Number ( chain ) ) ] ? (
509
+ { messageCounts ?. [ Number ( chain ) as ChainId ] ? (
510
510
< Typography
511
511
component = "div"
512
512
sx = { {
@@ -516,12 +516,12 @@ function Monitor({ governorInfo }: { governorInfo?: CloudGovernorInfo | null })
516
516
>
517
517
< Box sx = { missingBlockSx } />
518
518
={ ' ' }
519
- { messageCounts ?. [ toChainId ( Number ( chain ) ) ] ?. numMessagesWithoutVaas }
519
+ { messageCounts ?. [ Number ( chain ) as ChainId ] ?. numMessagesWithoutVaas }
520
520
521
521
< Box sx = { doneBlockSx } />
522
522
={ ' ' }
523
- { ( messageCounts ?. [ toChainId ( Number ( chain ) ) ] ?. numTotalMessages || 0 ) -
524
- ( messageCounts ?. [ toChainId ( Number ( chain ) ) ] ?. numMessagesWithoutVaas ||
523
+ { ( messageCounts ?. [ Number ( chain ) as ChainId ] ?. numTotalMessages || 0 ) -
524
+ ( messageCounts ?. [ Number ( chain ) as ChainId ] ?. numMessagesWithoutVaas ||
525
525
0 ) }
526
526
</ Typography >
527
527
) : null }
0 commit comments