{"size": 1217, "ext": "js", "max_stars_repo_path": "src/components/ApproveShiftButton.js", "max_stars_repo_name": "scmilee/elrn-universal-wallet", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/ApproveShiftButton.js", "max_issues_repo_name": "scmilee/elrn-universal-wallet", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/components/ApproveShiftButton.js", "max_forks_repo_name": "scmilee/elrn-universal-wallet", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 34.7714285714, "max_line_length": 172, "alphanum_fraction": 0.7255546426}
import React from 'react'
import { connect } from 'react-redux'
import { shift } from '../actions/shapeShiftActions'
import styles from '../styles.js'

const mapStateToProps = ({shapeShift, wallet}) => {
  return {
    withdrawalAddress: wallet.address,
    toSymbol: shapeShift.toSymbol,
    fromSymbol: shapeShift.fromSymbol,
    returnAddress: wallet.returnAddress,
    shiftAmount: shapeShift.shiftAmount
  }
}
const mapDispatchToProps = (dispatch, ownProps) => {
  return {
    handleApproveShiftButton: (withdrawalAddress, fromSymbol, toSymbol, returnAddress, shiftAmount) => {
      const pair = `${fromSymbol}_${toSymbol}`
      const options = {
        returnAddress: returnAddress,
        amount: shiftAmount
      }
      dispatch(shift(withdrawalAddress, pair, options))
    }
  }
}

export const ApproveShiftButton = ({ withdrawalAddress, fromSymbol, toSymbol, returnAddress, shiftAmount, handleApproveShiftButton, ...rest }) => {
  return (
    <button style={styles.buttonStyle} onClick={() => handleApproveShiftButton( withdrawalAddress, fromSymbol, toSymbol, returnAddress, shiftAmount)}>Request Quote</button>
  )
}

export default connect(mapStateToProps, mapDispatchToProps)(ApproveShiftButton)
