Sent.js 1.71 KiB
Newer Older
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
Amaury Martiny's avatar
Amaury Martiny committed
// SPDX-License-Identifier: BSD-3-Clause

import React, { Component } from 'react';
import { chainName$, withoutLoading } from '@parity/light.js';
import { inject, observer } from 'mobx-react';
import light from '@parity/light.js-react';
import { withProps } from 'recompose';
Luke Schoen's avatar
Luke Schoen committed
import { SentModal } from 'fether-ui';

import check from '../../assets/img/icons/check.svg';
import loading from '../../assets/img/icons/loading.svg';
import withTokens from '../../utils/withTokens';
import { blockscoutTxUrl } from '../../utils/blockscout';
Amaury Martiny's avatar
Amaury Martiny committed
// Number of confirmations to consider a transaction successful
const MIN_CONFIRMATIONS = 6;

  chainName: () => chainName$().pipe(withoutLoading())
})
@inject('sendStore')
@withTokens
@withProps(({ match: { params: { tokenAddress } }, tokens }) => ({
  token: tokens[tokenAddress]
}))
@observer
class Sent extends Component {
Amaury Martiny's avatar
Amaury Martiny committed
  componentWillMount () {
Luke Schoen's avatar
Luke Schoen committed
    // // If we refresh on this page, return to homepage
    // if (!this.props.sendStore.txStatus) {
    //   this.handleGoToHomepage();
    // }
  handleGoToHomepage = () => {
    const { history, sendStore } = this.props;
    sendStore.clear();
    history.push('/');
  };

  render () {
Luke Schoen's avatar
Luke Schoen committed
    const { chainName, sendStore, token } = this.props;

      <div className='window_content'>
Luke Schoen's avatar
Luke Schoen committed
        <SentModal
          blockscoutTxUrl={blockscoutTxUrl}
          chainName={chainName}
          check={check}
Luke Schoen's avatar
Luke Schoen committed
          handleGoToHomepage={this.handleGoToHomepage}
Luke Schoen's avatar
Luke Schoen committed
          loading={loading}
          minConfirmations={MIN_CONFIRMATIONS}
          sendStore={sendStore}
          token={token}
        />
      </div>
    );
  }
}

export default Sent;