From 64e4e0c0c722f74232dbe5776848a102676ef9b4 Mon Sep 17 00:00:00 2001 From: Manuel Wedler Date: Thu, 25 Sep 2025 18:04:32 +0200 Subject: [PATCH 1/5] Embed verify.sourcify.dev as Sourcify verification method --- .../ContractVerificationForm.pw.tsx | 52 +++------------ .../ContractVerificationForm.tsx | 2 +- ...nForm.pw.tsx_default_sourcify-method-1.png | Bin 0 -> 37966 bytes ...ContractVerificationFieldContractIndex.tsx | 61 ------------------ .../methods/ContractVerificationSourcify.tsx | 29 +++++---- ui/contractVerification/utils.ts | 13 +--- 6 files changed, 29 insertions(+), 128 deletions(-) create mode 100644 ui/contractVerification/__screenshots__/ContractVerificationForm.pw.tsx_default_sourcify-method-1.png delete mode 100644 ui/contractVerification/fields/ContractVerificationFieldContractIndex.tsx diff --git a/ui/contractVerification/ContractVerificationForm.pw.tsx b/ui/contractVerification/ContractVerificationForm.pw.tsx index 48515ba6b4..777b74daa2 100644 --- a/ui/contractVerification/ContractVerificationForm.pw.tsx +++ b/ui/contractVerification/ContractVerificationForm.pw.tsx @@ -3,7 +3,6 @@ import React from 'react'; import type { SmartContractVerificationConfig } from 'types/client/contract'; import { ENVS_MAP } from 'playwright/fixtures/mockEnvs'; -import * as socketServer from 'playwright/fixtures/socketServer'; import { test, expect } from 'playwright/lib'; import ContractVerificationForm from './ContractVerificationForm'; @@ -102,49 +101,18 @@ test('standard input json method', async({ render, page }) => { await expect(component).toHaveScreenshot(); }); -test.describe('sourcify', () => { - test.describe.configure({ mode: 'serial', timeout: 20_000 }); +test('sourcify method', async({ render, page }) => { + const component = await render( + , + { hooksConfig }, + { withSocket: true }, + ); - test('with multiple contracts', async({ render, page, createSocket }) => { - const component = await render( - , - { hooksConfig }, - { withSocket: true }, - ); - - // select method - await component.locator('button').filter({ hasText: 'Verification method' }).click(); - await page.getByRole('option', { name: 'Solidity (Sourcify)' }).click(); - - await page.getByText(/drop files/i).click(); - await page.locator('input[name="sources"]').setInputFiles([ - './playwright/mocks/file_mock_1.json', - './playwright/mocks/file_mock_2.json', - './playwright/mocks/file_mock_with_very_long_name.json', - ]); - - await expect(component).toHaveScreenshot(); - - const socket = await createSocket(); - const channel = await socketServer.joinChannel(socket, `addresses:${ hash.toLowerCase() }`); - - await page.getByRole('button', { name: /verify/i }).click(); - - socketServer.sendMessage(socket, channel, 'verification_result', { - status: 'error', - errors: { - // eslint-disable-next-line max-len - files: [ 'Detected 5 contracts (ERC20, IERC20, IERC20Metadata, Context, MockERC20), but can only verify 1 at a time. Please choose a main contract and click Verify again.' ], - }, - }); - - await component.locator('button').filter({ hasText: 'Contract name*' }).click(); - const contractNameOption = page.getByRole('option', { name: 'MockERC20' }); - - await expect(contractNameOption).toBeVisible(); + // select method + await component.locator('button').filter({ hasText: 'Verification method' }).click(); + await page.getByRole('option', { name: 'Solidity or Vyper (Sourcify)' }).click(); - await expect(component).toHaveScreenshot(); - }); + await expect(component).toHaveScreenshot(); }); test('multi-part files method', async({ render, page }) => { diff --git a/ui/contractVerification/ContractVerificationForm.tsx b/ui/contractVerification/ContractVerificationForm.tsx index 3a964c3216..6dbf8cea19 100644 --- a/ui/contractVerification/ContractVerificationForm.tsx +++ b/ui/contractVerification/ContractVerificationForm.tsx @@ -205,7 +205,7 @@ const ContractVerificationForm = ({ method: methodFromQuery, config, hash }: Pro { content } { formState.errors.root?.message && { formState.errors.root.message } } - { Boolean(method) && methodValue !== 'solidity-hardhat' && methodValue !== 'solidity-foundry' && ( + { Boolean(method) && methodValue !== 'solidity-hardhat' && methodValue !== 'solidity-foundry' && methodValue !== 'sourcify' && (