parent
40d4ac9ae1
commit
4e0693eaff
@ -1,2 +0,0 @@ |
||||
import TokenBalance from './token-balance.container' |
||||
module.exports = TokenBalance |
@ -1,16 +0,0 @@ |
||||
import React, { Component } from 'react' |
||||
import PropTypes from 'prop-types' |
||||
|
||||
export default class TokenBalance extends Component { |
||||
static propTypes = { |
||||
string: PropTypes.string, |
||||
symbol: PropTypes.string, |
||||
error: PropTypes.string, |
||||
} |
||||
|
||||
render () { |
||||
return ( |
||||
<div className="hide-text-overflow">{ this.props.string }</div> |
||||
) |
||||
} |
||||
} |
@ -0,0 +1 @@ |
||||
export { default } from './token-balance.container' |
@ -0,0 +1,23 @@ |
||||
import React, { PureComponent } from 'react' |
||||
import PropTypes from 'prop-types' |
||||
import classnames from 'classnames' |
||||
|
||||
export default class TokenBalance extends PureComponent { |
||||
static propTypes = { |
||||
string: PropTypes.string, |
||||
symbol: PropTypes.string, |
||||
error: PropTypes.string, |
||||
className: PropTypes.string, |
||||
withSymbol: PropTypes.bool, |
||||
} |
||||
|
||||
render () { |
||||
const { className, string, withSymbol, symbol } = this.props |
||||
|
||||
return ( |
||||
<div className={classnames('hide-text-overflow', className)}> |
||||
{ string + (withSymbol ? ` ${symbol}` : '') } |
||||
</div> |
||||
) |
||||
} |
||||
} |
@ -1,8 +1,8 @@ |
||||
import { connect } from 'react-redux' |
||||
import { compose } from 'recompose' |
||||
import withTokenTracker from '../../../../helpers/with-token-tracker' |
||||
import withTokenTracker from '../../higher-order-components/with-token-tracker' |
||||
import TokenBalance from './token-balance.component' |
||||
import selectors from '../../../../selectors' |
||||
import selectors from '../../selectors' |
||||
|
||||
const mapStateToProps = state => { |
||||
return { |
@ -0,0 +1 @@ |
||||
export { default } from './with-method-data.component' |
@ -0,0 +1,44 @@ |
||||
import React, { PureComponent } from 'react' |
||||
import PropTypes from 'prop-types' |
||||
import { getMethodData } from '../../helpers/confirm-transaction/util' |
||||
|
||||
export default function withMethodData (WrappedComponent) { |
||||
return class MethodDataWrappedComponent extends PureComponent { |
||||
static propTypes = { |
||||
transaction: PropTypes.object, |
||||
} |
||||
|
||||
static defaultProps = { |
||||
transaction: {}, |
||||
} |
||||
|
||||
state = { |
||||
methodData: {}, |
||||
} |
||||
|
||||
componentDidMount () { |
||||
this.fetchMethodData() |
||||
} |
||||
|
||||
async fetchMethodData () { |
||||
const { transaction } = this.props |
||||
const { txParams: { data = '' } = {} } = transaction |
||||
|
||||
if (data) { |
||||
const methodData = await getMethodData(data) |
||||
this.setState({ methodData }) |
||||
} |
||||
} |
||||
|
||||
render () { |
||||
const { methodData } = this.state |
||||
|
||||
return ( |
||||
<WrappedComponent |
||||
{ ...this.props } |
||||
methodData={methodData} |
||||
/> |
||||
) |
||||
} |
||||
} |
||||
} |
@ -0,0 +1 @@ |
||||
export { default } from './with-token-tracker.component' |
Loading…
Reference in new issue