diff --git a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/Buttons/index.tsx b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/Buttons/index.tsx index 65b10f30..82db6855 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/Buttons/index.tsx +++ b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/Buttons/index.tsx @@ -9,7 +9,11 @@ import { isReadMethod } from 'src/routes/safe/components/Balances/SendModal/scre const useStyles = makeStyles(styles) -const Buttons = ({ onClose }) => { +export interface ButtonProps { + onClose: () => void +} + +const Buttons = ({ onClose }: ButtonProps) => { const classes = useStyles() const { input: { value: method }, diff --git a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/ContractABI/index.tsx b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/ContractABI/index.tsx index 37aabf00..fe47ee3f 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/ContractABI/index.tsx +++ b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/ContractABI/index.tsx @@ -7,7 +7,7 @@ import { extractUsefulMethods } from 'src/logic/contractInteraction/sources/ABIS export const NO_DATA = 'no data' -const mustBeValidABI = (abi) => { +const mustBeValidABI = (abi: string): undefined | string => { try { const parsedABI = extractUsefulMethods(JSON.parse(abi)) @@ -15,7 +15,7 @@ const mustBeValidABI = (abi) => { return NO_DATA } } catch (e) { - return [] + return NO_DATA } } diff --git a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/EthAddressInput/index.tsx b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/EthAddressInput/index.tsx index cf5c652c..91ddf4df 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/EthAddressInput/index.tsx +++ b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/EthAddressInput/index.tsx @@ -16,7 +16,15 @@ import { styles } from 'src/routes/safe/components/Balances/SendModal/screens/Co const useStyles = makeStyles(styles) -const EthAddressInput = ({ isContract = true, isRequired = true, name, onScannedValue, text }) => { +export interface EthAddressProps { + isContract?: boolean + isRequired?: boolean + name: string + onScannedValue: (scannedValue: string) => void + text: string +} + +const EthAddressInput = ({ isContract = true, isRequired = true, name, onScannedValue, text }: EthAddressProps) => { const classes = useStyles() const validatorsList = [isRequired && required, mustBeEthereumAddress, isContract && mustBeEthereumContractAddress] const validate = composeValidators(...validatorsList.filter((_) => _)) diff --git a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/EthValue/index.tsx b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/EthValue/index.tsx index b9cafb46..0a020269 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/EthValue/index.tsx +++ b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/EthValue/index.tsx @@ -17,7 +17,10 @@ import { safeSelector } from 'src/routes/safe/store/selectors' const useStyles = makeStyles(styles) -const EthValue = ({ onSetMax }) => { +interface EthValueProps { + onSetMax: (ethBalance: string) => void +} +const EthValue = ({ onSetMax }: EthValueProps) => { const classes = useStyles() const { ethBalance } = useSelector(safeSelector) const { diff --git a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/Header/index.tsx b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/Header/index.tsx index e46798f1..b8a8dc5c 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/Header/index.tsx +++ b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/Header/index.tsx @@ -9,7 +9,13 @@ import { styles } from 'src/routes/safe/components/Balances/SendModal/screens/Co const useStyles = makeStyles(styles) -const Header = ({ onClose, subTitle, title }) => { +interface HeaderProps { + onClose: () => void + subTitle: string + title: string +} + +const Header = ({ onClose, subTitle, title }: HeaderProps) => { const classes = useStyles() return ( diff --git a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/MethodsDropdown/index.tsx b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/MethodsDropdown/index.tsx index b9988c81..30da6a7f 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/MethodsDropdown/index.tsx +++ b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/MethodsDropdown/index.tsx @@ -19,7 +19,11 @@ import { extractUsefulMethods } from 'src/logic/contractInteraction/sources/ABIS const MENU_WIDTH = '452px' -const MethodsDropdown = ({ onChange }) => { +interface MethodsDropdownProps { + onChange: ({}) => void +} + +const MethodsDropdown = ({ onChange }: MethodsDropdownProps) => { const classes = useDropdownStyles({ buttonWidth: MENU_WIDTH }) const { input: { value: abi }, diff --git a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/index.tsx b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/index.tsx index 34fa54bf..b99c3a90 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/index.tsx +++ b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/index.tsx @@ -22,7 +22,21 @@ import { abiExtractor, createTxObject, formMutators, handleSubmitError, isReadMe const useStyles = makeStyles(styles) -const ContractInteraction = ({ contractAddress, initialValues, onClose, onNext }) => { +export interface CreatedTx { + contractAddress: string + data: string + selectedMethod: {} + value: string | number +} + +export interface ContractInteractionProps { + contractAddress: string + initialValues: { contractAddress?: string } + onClose: () => void + onNext: ({}: CreatedTx) => void +} + +const ContractInteraction = ({ contractAddress, initialValues, onClose, onNext }: ContractInteractionProps) => { const classes = useStyles() const { address: safeAddress = '' } = useSelector(safeSelector) let setCallResults