-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor how we load and display contract verification info
Make it so that only the contract address is needed, and everything else is nicely wrapped in a component.
- Loading branch information
Showing
4 changed files
with
49 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { ContractVerificationIcon } from '../ContractVerificationIcon' | ||
import { FC } from 'react' | ||
import { SearchScope } from '../../../types/searchScope' | ||
import { Runtime, RuntimeAccount, useGetRuntimeAccountsAddress } from '../../../oasis-nexus/api' | ||
import Skeleton from '@mui/material/Skeleton' | ||
|
||
const Waiting: FC = () => <Skeleton variant="text" sx={{ display: 'inline-block', width: '100%' }} /> | ||
|
||
export const ContractVerificationInfo: FC<{ | ||
account?: RuntimeAccount | ||
noLink?: boolean | undefined | ||
}> = ({ account, noLink }) => { | ||
return account ? ( | ||
<ContractVerificationIcon | ||
verified={!!account.evm_contract?.verification} | ||
address_eth={account.address_eth!} | ||
noLink={noLink} | ||
/> | ||
) : ( | ||
<Waiting /> | ||
) | ||
} | ||
|
||
export const DelayedContractVerificationInfo: FC<{ | ||
scope: SearchScope | ||
contractOasisAddress: string | ||
noLink?: boolean | undefined | ||
}> = ({ scope, contractOasisAddress, noLink }) => { | ||
const accountQuery = useGetRuntimeAccountsAddress( | ||
scope.network, | ||
scope.layer as Runtime, | ||
contractOasisAddress, | ||
) | ||
|
||
return <ContractVerificationInfo account={accountQuery.data?.data} noLink={noLink} /> | ||
} |
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