diff --git a/ui/app/helpers/higher-order-components/with-method-data/index.js b/ui/app/helpers/higher-order-components/with-method-data/index.js deleted file mode 100644 index f511e1ae7..000000000 --- a/ui/app/helpers/higher-order-components/with-method-data/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './with-method-data.component' diff --git a/ui/app/helpers/higher-order-components/with-method-data/with-method-data.component.js b/ui/app/helpers/higher-order-components/with-method-data/with-method-data.component.js deleted file mode 100644 index 05b253f19..000000000 --- a/ui/app/helpers/higher-order-components/with-method-data/with-method-data.component.js +++ /dev/null @@ -1,65 +0,0 @@ -import React, { PureComponent } from 'react' -import PropTypes from 'prop-types' -import { getMethodDataAsync, getFourBytePrefix } from '../../utils/transactions.util' - -export default function withMethodData (WrappedComponent) { - return class MethodDataWrappedComponent extends PureComponent { - static propTypes = { - transaction: PropTypes.object, - knownMethodData: PropTypes.object, - addKnownMethodData: PropTypes.func, - } - - static defaultProps = { - transaction: {}, - knownMethodData: {}, - } - - state = { - methodData: {}, - done: false, - error: null, - } - - componentDidMount () { - this.fetchMethodData() - } - - async fetchMethodData () { - const { transaction, knownMethodData, addKnownMethodData } = this.props - const { txParams: { data = '' } = {} } = transaction - - if (data) { - try { - let methodData - const fourBytePrefix = getFourBytePrefix(data) - if (fourBytePrefix in knownMethodData) { - methodData = knownMethodData[fourBytePrefix] - } else { - methodData = await getMethodDataAsync(data) - if (!Object.entries(methodData).length === 0) { - addKnownMethodData(fourBytePrefix, methodData) - } - } - - this.setState({ methodData, done: true }) - } catch (error) { - this.setState({ done: true, error }) - } - } else { - this.setState({ done: true }) - } - } - - render () { - const { methodData, done, error } = this.state - - return ( - - ) - } - } -}