Remove unused code

pull/5285/head
Manuel Wedler 4 months ago committed by Aniket
parent 6c98d1a424
commit b94c57ac74
  1. 34
      apps/contract-verification/src/app/Receipts/EtherscanReceipt.tsx
  2. 36
      apps/contract-verification/src/app/Receipts/SourcifyReceipt.tsx
  3. 9
      apps/contract-verification/src/app/Receipts/props.ts
  4. 1
      apps/contract-verification/src/app/Verifiers/EtherscanVerifier.ts

@ -1,34 +0,0 @@
import React, { useState, useEffect } from 'react'
import { EtherscanVerifier } from '../Verifiers/EtherscanVerifier'
import { ReceiptProps } from './props'
export const EtherscanReceipt: React.FC<ReceiptProps> = ({ verifyPromise, address, chainId, verifier }) => {
const [status, setStatus] = useState<string | null>(null)
const [submissionDate] = useState(new Date())
useEffect(() => {
// Handle the promise here or perform other side effects
verifyPromise
.then(() => {
// Handle promise resolution
// Update status based on the result
})
.catch(() => {
// Handle promise rejection
})
// This effect should only run once on mount, hence the empty dependency array
}, [verifyPromise])
return (
<div>
<h1>Verification Receipt</h1>
<p>Address: {address}</p>
<p>Chain ID: {chainId}</p>
<p>Submission Date: {submissionDate.toLocaleString()}</p>
<p>Status: {status ? status : 'Pending'}</p>
</div>
)
}
export default EtherscanReceipt

@ -1,36 +0,0 @@
import React, { useState, useEffect } from 'react'
import { SourcifyVerifier } from '../Verifiers/SourcifyVerifier'
// import { SourcifyVerificationStatus } from '../types'
import { ReceiptProps } from './props'
// A receipt is something to be rendered
export const SourcifyReceipt: React.FC<ReceiptProps> = ({ verifyPromise, address, chainId, verifier }) => {
const [status, setStatus] = useState< null>(null)
const [submissionDate] = useState(new Date()) // This will be set once and not change
useEffect(() => {
// You might want to handle the promise here or perform other side effects
verifyPromise
.then(() => {
// Handle promise resolution
// Update status based on the result
})
.catch(() => {
// Handle promise rejection
})
// This effect should only run once on mount, hence the empty dependency array
}, [verifyPromise])
return (
<div>
<h1>Verification Receipt</h1>
<p>Address: {address}</p>
<p>Chain ID: {chainId}</p>
<p>Submission Date: {submissionDate.toLocaleString()}</p>
<p>Status: {status ? status : 'Pending'}</p>
</div>
)
}
export default SourcifyReceipt

@ -1,9 +0,0 @@
import { EtherscanVerifier } from '../Verifiers/EtherscanVerifier'
import { SourcifyVerifier } from '../Verifiers/SourcifyVerifier'
export interface ReceiptProps {
verifyPromise: Promise<any>
address: string
chainId: string
verifier: EtherscanVerifier | SourcifyVerifier
}

@ -76,7 +76,6 @@ export class EtherscanVerifier extends AbstractVerifier {
return { status: 'pending', receiptId: verificationResponse.result }
}
// TODO retry with backoff in case this throws error
async checkVerificationStatus(receiptId: string): Promise<VerificationStatus> {
const url = new URL(this.apiUrl + '/api')
url.searchParams.append('module', 'contract')

Loading…
Cancel
Save