diff --git a/apps/contract-verification/src/app/components/AccordionReceipt.tsx b/apps/contract-verification/src/app/components/AccordionReceipt.tsx new file mode 100644 index 0000000000..9ec05c8a99 --- /dev/null +++ b/apps/contract-verification/src/app/components/AccordionReceipt.tsx @@ -0,0 +1,66 @@ +import React from 'react' +import {SubmittedContract} from '../types/VerificationTypes' + +interface AccordionReceiptProps { + contract: SubmittedContract + index: number +} + +export const AccordionReceipt: React.FC = ({contract, index}) => { + const [expanded, setExpanded] = React.useState(false) + + const toggleAccordion = () => { + setExpanded(!expanded) + } + + return ( +
+
+

+ +
+ {contract.address} on {contract.chainId} (Add chain name) +
+

+
+
+
Chain ID: {contract.chainId}
+
+ filePath: {contract.filePath} contractName: {contract.contractName} +
+
Submission Date: {contract.date.toLocaleString()}
+
+ Receipts: +
+ + + + + + + + + + + + {contract.receipts.map((receipt) => ( + + + + + + + + ))} + +
VerifierAPI UrlStatusMessageReceiptID
{receipt.verifier.name}{receipt.verifier.apiUrl}{receipt.status}{receipt.message}{receipt.receiptId}
+
+
+
+
+
+
+ ) +} diff --git a/apps/contract-verification/src/app/views/ReceiptsView.tsx b/apps/contract-verification/src/app/views/ReceiptsView.tsx index b2aac0192c..8e2af70b59 100644 --- a/apps/contract-verification/src/app/views/ReceiptsView.tsx +++ b/apps/contract-verification/src/app/views/ReceiptsView.tsx @@ -1,36 +1,18 @@ import React from 'react' import {AppContext} from '../AppContext' +import example from './example.js' +import {AccordionReceipt} from '../components/AccordionReceipt' +import {SubmittedContract} from '../types/VerificationTypes' export const ReceiptsView = () => { - const {submittedContracts} = React.useContext(AppContext) + // const {submittedContracts} = React.useContext(AppContext); + const submittedContracts = example as unknown as SubmittedContract + console.log('submittedContracts', submittedContracts) return (
- {Object.values(submittedContracts).map((contract) => ( -
-
Contract Address: {contract.address}
-
Chain ID: {contract.chainId}
-
- filePath: {contract.filePath} contractName: {contract.contractName} -
-
Submission Date: {contract.date.toLocaleString()}
-
- Receipts:{' '} -
    - {contract.receipts.map((receipt) => ( -
  • -
      -
    • Verifier: {receipt.verifier.name}
    • -
    • API URL: {receipt.verifier.apiUrl}
    • -
    • Status: {receipt.status}
    • -
    • Receipt ID: {receipt.receiptId}
    • -
    • Message: {receipt.message}
    • -
    -
  • - ))} -
-
-
+ {Object.values(submittedContracts).map((contract, index) => ( + ))}
) diff --git a/apps/contract-verification/src/app/views/VerifyView.tsx b/apps/contract-verification/src/app/views/VerifyView.tsx index ad5947771a..d026c6af36 100644 --- a/apps/contract-verification/src/app/views/VerifyView.tsx +++ b/apps/contract-verification/src/app/views/VerifyView.tsx @@ -39,6 +39,7 @@ export const VerifyView = () => { const handleVerify = async (e) => { e.preventDefault() // Don't change the page + console.log('selectedContractFileAndName', selectedContractFileAndName) const [triggerFilePath, filePath, contractName] = selectedContractFileAndName.split(':') const enabledVerifiers = verifiers.filter((verifier) => verifier.enabled) const compilerAbstract = compilationOutput[triggerFilePath] diff --git a/apps/contract-verification/src/app/views/example.js b/apps/contract-verification/src/app/views/example.js new file mode 100644 index 0000000000..d013b96e0c --- /dev/null +++ b/apps/contract-verification/src/app/views/example.js @@ -0,0 +1,34 @@ +const json = { + 'undefined-0x2738d13E81e30bC615766A0410e7cF199FD59A83-Thu Jun 20 2024 22:32:36 GMT+0200 (Central European Summer Time)': { + id: 'undefined-0x2738d13E81e30bC615766A0410e7cF199FD59A83-Thu Jun 20 2024 22:32:36 GMT+0200 (Central European Summer Time)', + address: '0x2738d13E81e30bC615766A0410e7cF199FD59A83', + filePath: '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol', + contractName: 'Initializable', + date: '2024-06-20T20:32:36.361Z', + receipts: [ + { + verifier: { + name: 'Sourcify Localhost', + apiUrl: 'http://localhost:5555/', + enabled: true, + }, + status: 'error', + receiptId: null, + message: 'Failed to fetch', + }, + { + verifier: { + name: 'Etherscan', + apiUrl: 'https://api.etherscan.io', + enabled: true, + apiKey: 'API_KEY', + }, + status: 'error', + receiptId: null, + message: 'Failed to fetch', + }, + ], + }, +} + +module.exports = json