-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1201 from alleslabs/feature/upload-files-solidity
FRO-753: Feat: Verify Contract Solidity Upload Files
- Loading branch information
Showing
10 changed files
with
208 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/lib/pages/evm-contract-verify/components/FoundryInfoAccordion.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { | ||
Accordion, | ||
AccordionButton, | ||
AccordionIcon, | ||
AccordionItem, | ||
AccordionPanel, | ||
Text, | ||
} from "@chakra-ui/react"; | ||
import { UserDocsLink } from "lib/components/UserDocsLink"; | ||
|
||
export const FoundryInfoAccordion = () => ( | ||
<Accordion | ||
allowToggle | ||
defaultIndex={[0]} | ||
variant="transparent" | ||
position="sticky" | ||
top={0} | ||
> | ||
<AccordionItem> | ||
<AccordionButton> | ||
<Text | ||
variant="body2" | ||
fontWeight={700} | ||
color="text.main" | ||
textAlign="start" | ||
> | ||
What is Foundry? | ||
</Text> | ||
<AccordionIcon color="gray.600" ml="auto" /> | ||
</AccordionButton> | ||
<AccordionPanel | ||
bg="transparent" | ||
py={3} | ||
px={0} | ||
borderY="1px solid" | ||
borderColor="gray.700" | ||
> | ||
<Text variant="body2" color="text.dark" p={1}> | ||
Foundry is a framework that generates and submits contract metadata, | ||
ensuring accurate verification by matching the deployed bytecode. | ||
</Text> | ||
</AccordionPanel> | ||
<UserDocsLink | ||
mt={3} | ||
cta="See how to verify contract via Foundry" | ||
// TODO: Update link | ||
href="#" | ||
/> | ||
</AccordionItem> | ||
</Accordion> | ||
); |
51 changes: 51 additions & 0 deletions
51
src/lib/pages/evm-contract-verify/components/HardhatInfoAccordion.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { | ||
Accordion, | ||
AccordionButton, | ||
AccordionIcon, | ||
AccordionItem, | ||
AccordionPanel, | ||
Text, | ||
} from "@chakra-ui/react"; | ||
import { UserDocsLink } from "lib/components/UserDocsLink"; | ||
|
||
export const HarthatInfoAccordion = () => ( | ||
<Accordion | ||
allowToggle | ||
defaultIndex={[0]} | ||
variant="transparent" | ||
position="sticky" | ||
top={0} | ||
> | ||
<AccordionItem> | ||
<AccordionButton> | ||
<Text | ||
variant="body2" | ||
fontWeight={700} | ||
color="text.main" | ||
textAlign="start" | ||
> | ||
What is Hardhat? | ||
</Text> | ||
<AccordionIcon color="gray.600" ml="auto" /> | ||
</AccordionButton> | ||
<AccordionPanel | ||
bg="transparent" | ||
py={3} | ||
px={0} | ||
borderY="1px solid" | ||
borderColor="gray.700" | ||
> | ||
<Text variant="body2" color="text.dark" p={1}> | ||
Hardhat simplifies contract verification by generating metadata during | ||
compilation and automating the process through plugins. | ||
</Text> | ||
</AccordionPanel> | ||
<UserDocsLink | ||
mt={3} | ||
cta="See how to verify contract via Hardhat" | ||
// TODO: Update link | ||
href="#" | ||
/> | ||
</AccordionItem> | ||
</Accordion> | ||
); |
59 changes: 57 additions & 2 deletions
59
...ib/pages/evm-contract-verify/components/solidity/EvmContractVerifySolidityUploadFiles.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,58 @@ | ||
export const EvmContractVerifySolidityUploadFiles = () => { | ||
return <div>TODO: EvmContractVerifySolidityUploadFiles</div>; | ||
import { Heading, Stack } from "@chakra-ui/react"; | ||
import { Control, useFieldArray } from "react-hook-form"; | ||
import { EvmContractVerifyForm } from "../../types"; | ||
import { ConstructorArgs } from "../ConstructorArgs"; | ||
import { EvmVersionToTarget } from "../EvmVersionToTarget"; | ||
import { OptimizerConfiguration } from "../OptimizerConfiguration"; | ||
import { ContractLibraries } from "../ContractLibraries"; | ||
import { DropZone } from "lib/components/dropzone"; | ||
import { UploadCard } from "lib/components/upload"; | ||
import { Fragment } from "react"; | ||
|
||
interface EvmContractVerifySolidityUploadFilesProps { | ||
control: Control<EvmContractVerifyForm>; | ||
} | ||
|
||
export const EvmContractVerifySolidityUploadFiles = ({ | ||
control, | ||
}: EvmContractVerifySolidityUploadFilesProps) => { | ||
const { fields, append, remove } = useFieldArray({ | ||
control, | ||
name: "verifyForm.solidityUploadFiles.files", | ||
}); | ||
|
||
return ( | ||
<Stack spacing={12}> | ||
<Stack spacing={4}> | ||
<Heading as="h6" variant="h6"> | ||
Upload File(s) | ||
</Heading> | ||
{fields.map((field, index) => ( | ||
<Fragment key={field.id}> | ||
<UploadCard file={field.file} deleteFile={() => remove(index)} /> | ||
</Fragment> | ||
))} | ||
<DropZone | ||
setFiles={(files) => append(files.map((file) => ({ file })))} | ||
fileType={["sol"]} | ||
/> | ||
</Stack> | ||
<ConstructorArgs<EvmContractVerifyForm> | ||
control={control} | ||
name="verifyForm.solidityUploadFiles" | ||
/> | ||
<EvmVersionToTarget<EvmContractVerifyForm> | ||
control={control} | ||
name="verifyForm.solidityUploadFiles" | ||
/> | ||
<OptimizerConfiguration<EvmContractVerifyForm> | ||
control={control} | ||
name="verifyForm.solidityUploadFiles" | ||
/> | ||
<ContractLibraries<EvmContractVerifyForm> | ||
control={control} | ||
name="verifyForm.solidityUploadFiles" | ||
/> | ||
</Stack> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters