Commit da56e084 authored by tom's avatar tom

add filter for Yul contracts and display proper contract language

parent fc1cb043
...@@ -37,6 +37,7 @@ export interface SmartContract { ...@@ -37,6 +37,7 @@ export interface SmartContract {
}; };
verified_twin_address_hash: string | null; verified_twin_address_hash: string | null;
minimal_proxy_address_hash: string | null; minimal_proxy_address_hash: string | null;
language: string | null;
} }
export type SmartContractDecodedConstructorArg = [ export type SmartContractDecodedConstructorArg = [
......
...@@ -22,7 +22,7 @@ export interface VerifiedContractsResponse { ...@@ -22,7 +22,7 @@ export interface VerifiedContractsResponse {
export interface VerifiedContractsFilters { export interface VerifiedContractsFilters {
q: string | undefined; q: string | undefined;
filter: 'vyper' | 'solidity' | undefined; filter: 'vyper' | 'solidity' | 'yul' | undefined;
} }
export type VerifiedContractsCounters = { export type VerifiedContractsCounters = {
......
...@@ -74,7 +74,7 @@ const ContractSourceCode = ({ address, implementationAddress }: Props) => { ...@@ -74,7 +74,7 @@ const ContractSourceCode = ({ address, implementationAddress }: Props) => {
const heading = ( const heading = (
<Skeleton isLoaded={ !isLoading } fontWeight={ 500 }> <Skeleton isLoaded={ !isLoading } fontWeight={ 500 }>
<span>Contract source code</span> <span>Contract source code</span>
<Text whiteSpace="pre" as="span" variant="secondary"> ({ activeContract?.is_vyper_contract ? 'Vyper' : 'Solidity' })</Text> <Text whiteSpace="pre" as="span" variant="secondary" textTransform="capitalize"> ({ activeContract?.language })</Text>
</Skeleton> </Skeleton>
); );
......
...@@ -61,14 +61,10 @@ const VerifiedContracts = () => { ...@@ -61,14 +61,10 @@ const VerifiedContracts = () => {
return; return;
} }
if ((value === 'vyper' || value === 'solidity')) { const filter = value === 'all' ? undefined : value as VerifiedContractsFilters['filter'];
onFilterChange({ q: debouncedSearchTerm, filter: value });
setType(value);
return;
}
onFilterChange({ q: debouncedSearchTerm, filter: undefined }); onFilterChange({ q: debouncedSearchTerm, filter });
setType(undefined); setType(filter);
}, [ debouncedSearchTerm, onFilterChange ]); }, [ debouncedSearchTerm, onFilterChange ]);
const handleSortToggle = React.useCallback((field: SortField) => { const handleSortToggle = React.useCallback((field: SortField) => {
......
...@@ -35,6 +35,7 @@ const VerifiedContractsFilter = ({ onChange, defaultValue, isActive }: Props) => ...@@ -35,6 +35,7 @@ const VerifiedContractsFilter = ({ onChange, defaultValue, isActive }: Props) =>
<MenuItemOption value="all">All</MenuItemOption> <MenuItemOption value="all">All</MenuItemOption>
<MenuItemOption value="solidity">Solidity</MenuItemOption> <MenuItemOption value="solidity">Solidity</MenuItemOption>
<MenuItemOption value="vyper">Vyper</MenuItemOption> <MenuItemOption value="vyper">Vyper</MenuItemOption>
<MenuItemOption value="yul">Yul</MenuItemOption>
</MenuOptionGroup> </MenuOptionGroup>
</MenuList> </MenuList>
</Menu> </Menu>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment