Add verification_activated event

pull/5285/head
Manuel Wedler 2 months ago committed by Aniket
parent 375a88b188
commit f2ae242341
  1. 4
      apps/contract-verification/src/app/ContractVerificationPluginClient.ts
  2. 4
      apps/contract-verification/src/app/app.tsx

@ -11,4 +11,8 @@ export class ContractVerificationPluginClient extends PluginClient {
createClient(this)
this.onload()
}
onActivation(): void {
this.internalEvents.emit('verification_activated')
}
}

@ -36,6 +36,7 @@ const App = () => {
const timer = useRef(null)
useEffect(() => {
plugin.internalEvents.on('verification_activated', () => {
// Fetch compiler artefacts initially
plugin.call('compilerArtefacts' as any, 'getAllCompilerAbstracts').then((obj: any) => {
setCompilationOutput(obj)
@ -46,13 +47,12 @@ const App = () => {
setCompilationOutput((prev) => ({ ...(prev || {}), ...compilerAbstracts }))
})
// TODO: Is there a way to get all compilations from the `build-info` files without having to compile again?
// Fetch chains.json and update state
fetch('https://chainid.network/chains.json')
.then((response) => response.json())
.then((data) => setChains(data))
.catch((error) => console.error('Failed to fetch chains.json:', error))
})
// Clean up on unmount
return () => {

Loading…
Cancel
Save