Files
explore/ui/contractVerification/methods/ContractVerificationSolidityFoundry.tsx
wnhleeandGitHub 76b77e8f6c fix: correct missing base path in url (#3267)
* fix: correct missing base path in url

* test: add pw test for baseUrl fix

* chore: simplify tests

* chore: update snapshots
2026-02-09 18:48:25 +01:00

45 lines
1.7 KiB
TypeScript

import { Box, Flex } from '@chakra-ui/react';
import React from 'react';
import { useFormContext } from 'react-hook-form';
import type { FormFields } from '../types';
import config from 'configs/app';
import { Link } from 'toolkit/chakra/link';
import ContractVerificationFormCodeSnippet from '../ContractVerificationFormCodeSnippet';
import ContractVerificationFormRow from '../ContractVerificationFormRow';
import ContractVerificationMethod from '../ContractVerificationMethod';
const ContractVerificationSolidityFoundry = () => {
const { watch } = useFormContext<FormFields>();
const address = watch('address');
const generalApiEndpoint = config.apis.general ?
`${ config.apis.general.endpoint }${ config.apis.general.basePath ?? '' }` : '';
const codeSnippet = `forge verify-contract \\
--rpc-url ${ config.chain.rpcUrls[0] || (generalApiEndpoint ? `${ generalApiEndpoint }/api/eth-rpc` : '') } \\
--verifier blockscout \\
--verifier-url '${ generalApiEndpoint ? `${ generalApiEndpoint }/api/` : '' }' \\
${ address || '<address>' } \\
[contractFile]:[contractName]`;
return (
<ContractVerificationMethod title="Contract verification via Foundry">
<ContractVerificationFormRow>
<Flex flexDir="column">
<ContractVerificationFormCodeSnippet code={ codeSnippet }/>
</Flex>
<Box whiteSpace="pre-wrap">
<span>Full tutorial about contract verification via Foundry on Blockscout is available </span>
<Link href="https://docs.blockscout.com/devs/verification/foundry-verification" external>
here
</Link>
</Box>
</ContractVerificationFormRow>
</ContractVerificationMethod>
);
};
export default React.memo(ContractVerificationSolidityFoundry);