2017-09-25 02:06:28 +00:00
|
|
|
import { TShowNotification } from 'actions/notifications';
|
|
|
|
import {
|
|
|
|
TRestartSwap,
|
|
|
|
TStartOrderTimerSwap,
|
|
|
|
TStartPollBityOrderStatus,
|
|
|
|
TStopOrderTimerSwap,
|
|
|
|
TStopPollBityOrderStatus
|
|
|
|
} from 'actions/swap';
|
2017-12-11 17:44:53 +00:00
|
|
|
import { SwapInput } from 'reducers/swap/types';
|
2017-09-25 02:06:28 +00:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import BitcoinQR from './BitcoinQR';
|
|
|
|
import PaymentInfo from './PaymentInfo';
|
|
|
|
import SwapProgress from './SwapProgress';
|
|
|
|
|
|
|
|
interface ReduxStateProps {
|
|
|
|
destinationAddress: string;
|
2017-12-11 17:44:53 +00:00
|
|
|
origin: SwapInput;
|
|
|
|
destination: SwapInput;
|
2017-09-25 02:06:28 +00:00
|
|
|
reference: string;
|
|
|
|
secondsRemaining: number | null;
|
|
|
|
paymentAddress: string | null;
|
|
|
|
orderStatus: string | null;
|
|
|
|
outputTx: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ReduxActionProps {
|
|
|
|
restartSwap: TRestartSwap;
|
|
|
|
startOrderTimerSwap: TStartOrderTimerSwap;
|
|
|
|
startPollBityOrderStatus: TStartPollBityOrderStatus;
|
|
|
|
stopOrderTimerSwap: TStopOrderTimerSwap;
|
|
|
|
stopPollBityOrderStatus: TStopPollBityOrderStatus;
|
|
|
|
showNotification: TShowNotification;
|
|
|
|
}
|
|
|
|
|
2017-12-11 17:44:53 +00:00
|
|
|
export default class PartThree extends Component<ReduxActionProps & ReduxStateProps, {}> {
|
2017-09-25 02:06:28 +00:00
|
|
|
public componentDidMount() {
|
|
|
|
this.props.startPollBityOrderStatus();
|
|
|
|
this.props.startOrderTimerSwap();
|
|
|
|
}
|
|
|
|
|
|
|
|
public componentWillUnmount() {
|
|
|
|
this.props.stopOrderTimerSwap();
|
|
|
|
this.props.stopPollBityOrderStatus();
|
|
|
|
}
|
|
|
|
|
|
|
|
public render() {
|
|
|
|
const {
|
|
|
|
// STATE
|
2017-12-11 17:44:53 +00:00
|
|
|
origin,
|
|
|
|
destination,
|
2017-09-25 02:06:28 +00:00
|
|
|
paymentAddress,
|
|
|
|
orderStatus,
|
|
|
|
destinationAddress,
|
|
|
|
outputTx,
|
|
|
|
// ACTIONS
|
|
|
|
showNotification
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
const SwapProgressProps = {
|
2017-12-11 17:44:53 +00:00
|
|
|
originId: origin.id,
|
|
|
|
destinationId: destination.id,
|
2017-09-25 02:06:28 +00:00
|
|
|
orderStatus,
|
|
|
|
showNotification,
|
|
|
|
destinationAddress,
|
|
|
|
outputTx
|
|
|
|
};
|
|
|
|
|
|
|
|
const PaymentInfoProps = {
|
2017-12-11 17:44:53 +00:00
|
|
|
origin,
|
2017-09-25 02:06:28 +00:00
|
|
|
paymentAddress
|
|
|
|
};
|
|
|
|
|
|
|
|
const BitcoinQRProps = {
|
|
|
|
paymentAddress,
|
2017-12-11 17:44:53 +00:00
|
|
|
destinationAmount: destination.amount
|
2017-09-25 02:06:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<SwapProgress {...SwapProgressProps} />
|
|
|
|
<PaymentInfo {...PaymentInfoProps} />
|
2017-12-11 17:44:53 +00:00
|
|
|
{orderStatus === 'OPEN' && origin.id === 'BTC' && <BitcoinQR {...BitcoinQRProps} />}
|
2017-09-25 02:06:28 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|