Skip to content

Commit

Permalink
Show error if LBC is unavailable for shapeshifting
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Yesmunt committed Jul 9, 2018
1 parent de5a76d commit bf2bc68
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/renderer/component/shapeShift/internal/active-shift.jsx
Expand Up @@ -56,7 +56,7 @@ class ActiveShapeShift extends React.PureComponent<Props> {
}
}

continousFetch: ?number;
continousFetch: ?IntervalID;

render() {
const {
Expand Down Expand Up @@ -135,8 +135,8 @@ class ActiveShapeShift extends React.PureComponent<Props> {
{shiftState === statuses.NO_DEPOSITS &&
shiftReturnAddress && (
<div className="help">
If the transaction doesn't go through, ShapeShift will return your {shiftCoinType}{' '}
back to {shiftReturnAddress}
{__("If the transaction doesn't go through, ShapeShift will return your")}{' '}
{shiftCoinType} {__('back to')} {shiftReturnAddress}
</div>
)}
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/constants/shape_shift.js
@@ -1,3 +1,5 @@
export const NO_DEPOSITS = 'no_deposits';
export const RECEIVED = 'received';
export const COMPLETE = 'complete';
export const AVAILABLE = 'available';
export const UNAVAILABLE = 'unavailable';
11 changes: 9 additions & 2 deletions src/renderer/redux/actions/shape_shift.js
@@ -1,5 +1,6 @@
// @flow
import Promise from 'bluebird';
import * as SHAPESHIFT_STATUSES from 'constants/shape_shift';
import * as ACTIONS from 'constants/action_types';
import { coinRegexPatterns } from 'util/shape_shift';
import type {
Expand Down Expand Up @@ -65,9 +66,15 @@ export const shapeShiftInit = () => (dispatch: Dispatch): ThunkAction => {
return shapeShift
.coinsAsync()
.then(coinData => {
if (coinData.LBC.status === SHAPESHIFT_STATUSES.UNAVAILABLE) {
return dispatch({
type: ACTIONS.GET_SUPPORTED_COINS_FAIL,
});
}

let supportedCoins = [];
Object.keys(coinData).forEach(symbol => {
if (coinData[symbol].status === 'available') {
if (coinData[symbol].status === SHAPESHIFT_STATUSES.UNAVAILABLE) {
supportedCoins.push(coinData[symbol]);
}
});
Expand All @@ -81,7 +88,7 @@ export const shapeShiftInit = () => (dispatch: Dispatch): ThunkAction => {
type: ACTIONS.GET_SUPPORTED_COINS_SUCCESS,
data: supportedCoins,
});
dispatch(getCoinStats(supportedCoins[0]));
return dispatch(getCoinStats(supportedCoins[0]));
})
.catch(err => dispatch({ type: ACTIONS.GET_SUPPORTED_COINS_FAIL, data: err }));
};
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/redux/reducers/shape_shift.js
Expand Up @@ -117,7 +117,7 @@ export default handleActions(
[ACTIONS.GET_SUPPORTED_COINS_FAIL]: (state: ShapeShiftState): ShapeShiftState => ({
...state,
loading: false,
error: 'Error getting available coins',
error: __('There was an error. Please try again later.'),
}),

[ACTIONS.GET_COIN_STATS_START]: (
Expand Down

0 comments on commit bf2bc68

Please sign in to comment.