import { ContractData , WrappedComponentProps } from './index' ; import { getAddress } from '../utils/getAddress' ; description param props param contract_name param contract_address export function getContractFromProps ( props , contract_name , contract_address ) { if ( ! contract_name || ! contract_address ) { return null ; } const contract_idx = props . contracts . findIndex ( ( elem ) : boolean => elem . contract === contract_name && getAddress ( elem . address ) === getAddress ( contract_address ) ) ; if ( contract_idx !== - 1 && props . contracts [ contract_idx ] . instance && props . contracts [ contract_idx ] . instance . valid === true ) return props . contracts [ contract_idx ] ; return null ; }