@@ -95,36 +95,53 @@ export const CHAIN_DELTA: Record<Networks, number> = {
95
95
}
96
96
97
97
const DEFAULT_METIS_HEALTH_ENDPOINT = 'https://andromeda-healthy.metisdevops.link/health'
98
- export const HEALTH_ENDPOINTS : Record <
98
+ const DEFAULT_SCROLL_HEALTH_ENDPOINT = 'https://venus.scroll.io/v1/sequencer/status'
99
+
100
+ export type HeathEndpoints = Record <
99
101
Networks ,
100
- { endpoint : string | undefined ; responsePath : string [ ] }
101
- > = {
102
+ {
103
+ endpoint : string | undefined
104
+ responsePath : string [ ]
105
+ processResponse : ( data : unknown ) => boolean | undefined
106
+ }
107
+ >
108
+
109
+ export const HEALTH_ENDPOINTS : HeathEndpoints = {
102
110
[ Networks . Arbitrum ] : {
103
111
endpoint : util . getEnv ( 'ARBITRUM_HEALTH_ENDPOINT' ) ,
104
112
responsePath : [ ] ,
113
+ processResponse : ( ) => undefined ,
105
114
} ,
106
115
[ Networks . Optimism ] : {
107
116
endpoint : util . getEnv ( 'OPTIMISM_HEALTH_ENDPOINT' ) ,
108
117
responsePath : [ 'healthy' ] ,
118
+ processResponse : ( ) => undefined ,
109
119
} ,
110
120
[ Networks . Base ] : {
111
121
endpoint : util . getEnv ( 'BASE_HEALTH_ENDPOINT' ) ,
112
122
responsePath : [ ] ,
123
+ processResponse : ( ) => undefined ,
113
124
} ,
114
125
[ Networks . Metis ] : {
115
126
endpoint : util . getEnv ( 'METIS_HEALTH_ENDPOINT' ) || DEFAULT_METIS_HEALTH_ENDPOINT ,
116
127
responsePath : [ 'healthy' ] ,
128
+ processResponse : ( data : unknown ) => defaultProcessResponse ( data , Networks . Metis ) ,
117
129
} ,
118
130
[ Networks . Scroll ] : {
119
- endpoint : util . getEnv ( 'SCROLL_HEALTH_ENDPOINT' ) ,
120
- responsePath : [ ] ,
131
+ endpoint : util . getEnv ( 'SCROLL_HEALTH_ENDPOINT' ) || DEFAULT_SCROLL_HEALTH_ENDPOINT ,
132
+ responsePath : [ 'data' , 'health' ] ,
133
+ processResponse : ( data : unknown ) => Requester . getResult ( data , [ 'data' , 'health' ] ) == 1 ,
121
134
} ,
122
135
[ Networks . Starkware ] : {
123
136
endpoint : util . getEnv ( 'STARKWARE_HEALTH_ENDPOINT' ) ,
124
137
responsePath : [ ] ,
138
+ processResponse : ( ) => undefined ,
125
139
} ,
126
140
}
127
141
142
+ const defaultProcessResponse = ( data : unknown , network : Networks ) =>
143
+ ! ! Requester . getResult ( data , HEALTH_ENDPOINTS [ network ] ?. responsePath )
144
+
128
145
export interface ExtendedConfig extends Config {
129
146
deltaBlocks : number
130
147
deltaChain : Record < Networks , number >
0 commit comments