diff --git a/packages/page-contracts/src/Contracts/Add.tsx b/packages/page-contracts/src/Contracts/Add.tsx index f13424de99..53cce73b86 100644 --- a/packages/page-contracts/src/Contracts/Add.tsx +++ b/packages/page-contracts/src/Contracts/Add.tsx @@ -92,7 +92,6 @@ function Add ({ onClose }: Props): React.ReactElement { { - const { className, contractAbi, errorText, isContract = false, isDisabled, isError, isFull, isSupplied, isValid, onChange, withLabel } = props; + const { className, contractAbi, errorText, isDisabled, isError, isFull, isValid, onChange, withLabel } = props; const { t } = useTranslation(); - const help = isContract - ? t('The ABI for the WASM code. Since we will be making a call into the code, the ABI is required and stored for future operations such as sending messages.') - : t('The ABI for the WASM code. In this step it is optional, but setting it here simplifies the setup of contract instances.'); - const label = isContract - ? 'contract ABI' - : 'contract ABI (optional)'; + const help = t('The ABI for the WASM code. The ABI is required and stored for future operations such as sending messages.'); + const label = t('contract ABI'); return (
@@ -78,11 +73,7 @@ function ABI (props: Props): React.ReactElement { isFull={isFull} label={label} onChange={onChange} - placeholder={ - isSupplied && !isValid - ? <>{t('invalid ABI file selected')}{!!errorText && ` — ${errorText}`} - : t('click to select or drag and drop a JSON ABI file') - } + placeholder={errorText || t('click to select or drag and drop a JSON ABI file')} /> ) } diff --git a/packages/page-contracts/src/useAbi.ts b/packages/page-contracts/src/useAbi.ts index e809f410d9..c14425401b 100644 --- a/packages/page-contracts/src/useAbi.ts +++ b/packages/page-contracts/src/useAbi.ts @@ -46,7 +46,7 @@ export default function useAbi (initialValue: [string | null | undefined, Abi | console.error(error); setAbi([null, null, false, false]); - setError([true, error]); + setError([true, (error as Error).message]); } }, [codeHash]