Skip to content
This repository has been archived by the owner on Apr 28, 2023. It is now read-only.

Commit

Permalink
feat: handle zero conf swaps (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael1011 authored Jun 26, 2019
1 parent a38a159 commit 7555fb9
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 132 deletions.
167 changes: 59 additions & 108 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@
"react-jss": "^8.6.1",
"react-loader-spinner": "^2.3.0",
"react-notifications-component": "^1.1.1",
"react-redux": "^7.0.3",
"react-redux": "^7.1.0",
"react-responsive-modal": "^4.0.1",
"react-router-dom": "^5.0.0",
"react-router-dom": "^5.0.1",
"react-scripts": "^3.0.1",
"react-switch": "^5.0.0",
"redux": "^4.0.1",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
Expand All @@ -59,6 +60,6 @@
"eslint-plugin-html": "^5.0.5",
"eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-react": "^7.13.0",
"prettier": "^1.17.1"
"prettier": "^1.18.2"
}
}
16 changes: 14 additions & 2 deletions src/views/reverse/reverse.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ const styles = () => ({
class ReverseSwap extends React.Component {
constructor(props) {
super(props);

this.notificationDom = React.createRef();

this.state = {
allowZeroConf: false,
};
}

componentDidMount = () => {
Expand Down Expand Up @@ -112,8 +117,8 @@ class ReverseSwap extends React.Component {
<Prompt />
<View className={classes.wrapper}>
<StepsWizard
range={4}
stage={1}
range={4}
id={swapResponse ? swapResponse.id : null}
onExit={() => {
if (window.confirm('Are you sure you want to exit')) {
Expand All @@ -138,6 +143,11 @@ class ReverseSwap extends React.Component {
<LockingFunds
swapInfo={swapInfo}
swapResponse={swapResponse}
setAllowZeroConf={allow => {
this.setState({
allowZeroConf: allow,
});
}}
/>
)}
/>
Expand Down Expand Up @@ -198,7 +208,9 @@ class ReverseSwap extends React.Component {
num={2}
render={props => (
<Controls
loading={isFetching}
loading={isFetching && !this.state.allowZeroConf}
text={'Accept 0-conf transaction'}
onPress={() => props.nextStage()}
loadingText={'Locking your funds...'}
loadingRender={() => <Loading />}
error={!swapFailResponse === true}
Expand Down
Loading

0 comments on commit 7555fb9

Please sign in to comment.