// Copyright 2015, 2016 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // Parity is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; import ActionDoneAll from 'material-ui/svg-icons/action/done-all'; import ContentClear from 'material-ui/svg-icons/content/clear'; import { Button, IdentityIcon, Modal } from '~/ui'; import initShapeshift from '~/3rdparty/shapeshift'; import shapeshiftLogo from '../../../assets/images/shapeshift-logo.png'; import AwaitingDepositStep from './AwaitingDepositStep'; import AwaitingExchangeStep from './AwaitingExchangeStep'; import CompletedStep from './CompletedStep'; import ErrorStep from './ErrorStep'; import OptionsStep from './OptionsStep'; import styles from './shapeshift.css'; const shapeshift = initShapeshift(); const STAGE_NAMES = ['details', 'awaiting deposit', 'awaiting exchange', 'completed']; export default class Shapeshift extends Component { static contextTypes = { store: PropTypes.object.isRequired } static propTypes = { address: PropTypes.string.isRequired, onClose: PropTypes.func } state = { stage: 0, coinSymbol: 'BTC', coinPair: 'btc_eth', coins: [], depositAddress: '', refundAddress: '', price: null, depositInfo: null, exchangeInfo: null, error: {}, hasAccepted: false, shifting: false } componentDidMount () { this.retrieveCoins(); } componentWillUnmount () { this.unsubscribe(); } unsubscribe () { // Unsubscribe from Shapeshit const { depositAddress } = this.state; shapeshift.unsubscribe(depositAddress); } render () { const { error, stage } = this.state; return ( { this.renderPage() } ); } renderDialogActions () { const { address } = this.props; const { coins, error, stage, hasAccepted, shifting } = this.state; const logo = ( ); const cancelBtn = (