@@ -36,24 +36,24 @@ const App = () => {
36
36
const timer = useRef ( null )
37
37
38
38
useEffect ( ( ) => {
39
- // Fetch compiler artefacts initially
40
- plugin . call ( 'compilerArtefacts' as any , 'getAllCompilerAbstracts' ) . then ( ( obj : any ) => {
41
- setCompilationOutput ( obj )
39
+ plugin . internalEvents . on ( 'verification_activated' , ( ) => {
40
+ // Fetch compiler artefacts initially
41
+ plugin . call ( 'compilerArtefacts' as any , 'getAllCompilerAbstracts' ) . then ( ( obj : any ) => {
42
+ setCompilationOutput ( obj )
43
+ } )
44
+
45
+ // Subscribe to compilations
46
+ plugin . on ( 'compilerArtefacts' as any , 'compilationSaved' , ( compilerAbstracts : { [ key : string ] : CompilerAbstract } ) => {
47
+ setCompilationOutput ( ( prev ) => ( { ...( prev || { } ) , ...compilerAbstracts } ) )
48
+ } )
49
+
50
+ // Fetch chains.json and update state
51
+ fetch ( 'https://chainid.network/chains.json' )
52
+ . then ( ( response ) => response . json ( ) )
53
+ . then ( ( data ) => setChains ( data ) )
54
+ . catch ( ( error ) => console . error ( 'Failed to fetch chains.json:' , error ) )
42
55
} )
43
56
44
- // Subscribe to compilations
45
- plugin . on ( 'compilerArtefacts' as any , 'compilationSaved' , ( compilerAbstracts : { [ key : string ] : CompilerAbstract } ) => {
46
- setCompilationOutput ( ( prev ) => ( { ...( prev || { } ) , ...compilerAbstracts } ) )
47
- } )
48
-
49
- // TODO: Is there a way to get all compilations from the `build-info` files without having to compile again?
50
-
51
- // Fetch chains.json and update state
52
- fetch ( 'https://chainid.network/chains.json' )
53
- . then ( ( response ) => response . json ( ) )
54
- . then ( ( data ) => setChains ( data ) )
55
- . catch ( ( error ) => console . error ( 'Failed to fetch chains.json:' , error ) )
56
-
57
57
// Clean up on unmount
58
58
return ( ) => {
59
59
plugin . off ( 'compilerArtefacts' as any , 'compilationSaved' )
0 commit comments