@@ -30,6 +30,7 @@ import {
30
30
getSortedRowModel ,
31
31
useReactTable ,
32
32
} from '@tanstack/react-table' ;
33
+ import { GUARDIAN_SET_4 , chainIdToName } from '@wormhole-foundation/wormhole-monitor-common' ;
33
34
import numeral from 'numeral' ;
34
35
import React , { useCallback , useMemo , useState } from 'react' ;
35
36
import {
@@ -38,13 +39,13 @@ import {
38
39
EnqueuedVAA ,
39
40
GovernorToken ,
40
41
} from '../hooks/useCloudGovernorInfo' ;
41
- import { CHAIN_ICON_MAP } from '../utils/consts' ;
42
+ import { CHAIN_ICON_MAP , WORMHOLE_RPC_HOSTS } from '../utils/consts' ;
43
+ import { getQuorumLossCount } from './Alerts' ;
42
44
import CollapsibleSection from './CollapsibleSection' ;
43
45
import EnqueuedVAAChecker from './EnqueuedVAAChecker' ;
44
46
import { ExplorerAssetURL } from './ExplorerAssetURL' ;
45
47
import { ExplorerTxHash } from './ExplorerTxHash' ;
46
48
import Table from './Table' ;
47
- import { GUARDIAN_SET_4 , chainIdToName } from '@wormhole-foundation/wormhole-monitor-common' ;
48
49
49
50
const calculatePercent = ( notional : AvailableNotionalByChain ) : number => {
50
51
try {
@@ -185,7 +186,26 @@ const enqueuedColumnHelper = createColumnHelper<EnqueuedVAA>();
185
186
const enqueuedColumns = [
186
187
enqueuedColumnHelper . accessor ( 'emitterChain' , {
187
188
header : ( ) => 'Chain' ,
188
- cell : ( info ) => `${ chainIdToName ( info . getValue ( ) ) } (${ info . getValue ( ) } )` ,
189
+ cell : ( info ) => (
190
+ < Typography variant = "body2" noWrap sx = { { pl : info . row . original . byGuardian ? 0 : 3 } } >
191
+ { info . row . getCanExpand ( ) ? (
192
+ < IconButton
193
+ size = "small"
194
+ sx = { { ml : - 1 } }
195
+ { ...{
196
+ onClick : info . row . getToggleExpandedHandler ( ) ,
197
+ } }
198
+ >
199
+ { info . row . getIsExpanded ( ) ? (
200
+ < KeyboardArrowDown fontSize = "inherit" />
201
+ ) : (
202
+ < KeyboardArrowRight fontSize = "inherit" />
203
+ ) }
204
+ </ IconButton >
205
+ ) : null } { ' ' }
206
+ { chainIdToName ( info . getValue ( ) ) } ({ info . getValue ( ) } )
207
+ </ Typography >
208
+ ) ,
189
209
sortingFn : `text` ,
190
210
} ) ,
191
211
enqueuedColumnHelper . accessor ( 'emitterAddress' , {
@@ -195,7 +215,7 @@ const enqueuedColumns = [
195
215
header : ( ) => 'Sequence' ,
196
216
cell : ( info ) => (
197
217
< Link
198
- href = { `https://wormhole-v2-mainnet-api.certus.one /v1/signed_vaa/${ info . row . original . emitterChain } /${ info . row . original . emitterAddress } /${ info . row . original . sequence } ` }
218
+ href = { `${ WORMHOLE_RPC_HOSTS [ 0 ] } /v1/signed_vaa/${ info . row . original . emitterChain } /${ info . row . original . emitterAddress } /${ info . row . original . sequence } ` }
199
219
target = "_blank"
200
220
rel = "noopener noreferrer"
201
221
>
@@ -206,12 +226,13 @@ const enqueuedColumns = [
206
226
enqueuedColumnHelper . display ( {
207
227
id : 'hasQuorum' ,
208
228
header : ( ) => 'Has Quorum?' ,
209
- cell : ( info ) => < EnqueuedVAAChecker vaa = { info . row . original } /> ,
229
+ cell : ( info ) =>
230
+ info . row . original . byGuardian ? < EnqueuedVAAChecker vaa = { info . row . original } /> : null ,
210
231
} ) ,
211
232
enqueuedColumnHelper . display ( {
212
233
id : 'numGuardians' ,
213
234
header : ( ) => 'Num Holding' ,
214
- cell : ( info ) => Object . keys ( info . row . original . byGuardian ) . length ,
235
+ cell : ( info ) => info . row . original . byGuardian ? .length || info . row . original . guardianName || null ,
215
236
} ) ,
216
237
enqueuedColumnHelper . accessor ( 'txHash' , {
217
238
header : ( ) => 'Transaction Hash' ,
@@ -220,8 +241,19 @@ const enqueuedColumns = [
220
241
) ,
221
242
} ) ,
222
243
enqueuedColumnHelper . accessor ( 'releaseTime' , {
223
- header : ( ) => 'Release Time' ,
224
- cell : ( info ) => new Date ( info . getValue ( ) * 1000 ) . toLocaleString ( ) ,
244
+ header : ( ) => 'Estimated Release Time' ,
245
+ cell : ( info ) => {
246
+ const sortedTimes = info . row . original . byGuardian ?. map ( ( v ) => v . releaseTime ) . sort ( ) ;
247
+ const quorumTime =
248
+ sortedTimes && sortedTimes [ Math . max ( 0 , sortedTimes . length - getQuorumLossCount ( 'Mainnet' ) ) ] ;
249
+ const rawTime = quorumTime ? quorumTime : info . getValue ( ) ;
250
+ const date = new Date ( rawTime * 1000 ) ;
251
+ return (
252
+ < >
253
+ { date . toLocaleString ( ) } ({ date . toISOString ( ) } )
254
+ </ >
255
+ ) ;
256
+ } ,
225
257
} ) ,
226
258
enqueuedColumnHelper . accessor ( 'notionalValue' , {
227
259
header : ( ) => < Box order = "1" > Notional Value</ Box > ,
@@ -313,14 +345,25 @@ function MainnetGovernor({ governorInfo }: { governorInfo: CloudGovernorInfo })
313
345
onSortingChange : setGuardianHoldingSorting ,
314
346
} ) ;
315
347
const [ enqueuedSorting , setEnqueuedSorting ] = useState < SortingState > ( [ ] ) ;
348
+ const [ enqueuedExpanded , setEnqueuedExpanded ] = useState < ExpandedState > ( { } ) ;
316
349
const enqueuedTable = useReactTable ( {
317
350
columns : enqueuedColumns ,
318
351
data : governorInfo . enqueuedVAAs ,
319
352
state : {
353
+ expanded : enqueuedExpanded ,
320
354
sorting : enqueuedSorting ,
321
355
} ,
356
+ initialState : {
357
+ pagination : {
358
+ pageIndex : 0 ,
359
+ pageSize : 50 ,
360
+ } ,
361
+ } ,
322
362
getRowId : ( vaa ) => JSON . stringify ( vaa ) ,
363
+ getSubRows : ( row ) => row . byGuardian ,
323
364
getCoreRowModel : getCoreRowModel ( ) ,
365
+ getExpandedRowModel : getExpandedRowModel ( ) ,
366
+ onExpandedChange : setEnqueuedExpanded ,
324
367
getPaginationRowModel : getPaginationRowModel ( ) ,
325
368
getSortedRowModel : getSortedRowModel ( ) ,
326
369
onSortingChange : setEnqueuedSorting ,
0 commit comments