-
Notifications
You must be signed in to change notification settings - Fork 59
Add fee selection to Open Channel form #182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I added the ability to manually specify a custom fee (sats/byte) in the fee selection field. It also displays a warning if the specified fee is larger than the fastest recommended fee. |
|
I just committed an alternative UI using a slider instead of the toggle/input combo. I think this may be a better solution as it reduces the chances of someone fat-fingering a really high fee unnecessarily. It also greatly simplifies the error detection code. If you prefer the previous UI, then I can easily revert the last commit. I just wanted to throw this out there as I felt it is a better approach. |
|
Love the new UI. Will be taking a look at this a little later, but definitely prefer this direction! |
wbobeirne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just worried about the chainsend comment, if that's all good then I'm 100% 👍 on this one. Great work!
| capacity, | ||
| isPrivate, | ||
| // only send non-zero fee | ||
| fee: fee ? fee.toString() : undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does handleFeeSubmit in ChainSend need the same consideration here? Looks like it could send 0 right now.
| switch (v) { | ||
| case onChainFees.fastestFee: return 'fastest'; | ||
| case onChainFees.halfHourFee: return 'normal'; | ||
| case onChainFees.hourFee: return 'slow'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice if these kept the number as well, e.g. 16 (normal)
|
Great feedback. Thanks for the review. I’ll get these couple items fixed up as soon as I can. |
| this.props.getOnChainFeeEstimates(); | ||
| } | ||
|
|
||
| componentWillReceiveProps(nextProps: Props) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI componentWillReceiveProps will be deprecated in React 17 and generally a good upgrade path for this kind of function is to use componentDidUpdate instead and compare against prevProps instead of nextProps
https://reactjs.org/docs/react-component.html#updating
More of a long term consideration but noticed it because I write a ton of React and have gotten used to it by now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh React, always deprecating lifecycles... Thanks for the heads up! We can probably let this one slip since we're using this lifecycle in quite a few places, and can just do one big refactor when we come around to v17.
| const { onChainFees } = this.props; | ||
| if (nextProps.onChainFees !== onChainFees && nextProps.onChainFees !== null) { | ||
| const { fastestFee } = nextProps.onChainFees; | ||
| this.setState({ fee: fastestFee }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also just took a look at the parent component and am wondering whether you wouldn’t need local state in this component and you can just pass the fee as a prop from the ChainSend component since it seems like you’re managing changes to both this local state and the parents local state?
All good if you have your reasoning that I don’t see, but in any case these are just architecture suggestions and not functionally critical.
Love the slider UI btw 👍👍👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this idea, making it a controlled component rather than an uncontrolled one. Better matches the paradigm of most input components we have.
wbobeirne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jamaljsr I've got some free time today so I'm going to tackle the PR feedback here. I'll push the changes up and wait for you to 👍 before merging in.
| const { onChainFees } = this.props; | ||
| if (nextProps.onChainFees !== onChainFees && nextProps.onChainFees !== null) { | ||
| const { fastestFee } = nextProps.onChainFees; | ||
| this.setState({ fee: fastestFee }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this idea, making it a controlled component rather than an uncontrolled one. Better matches the paradigm of most input components we have.
| this.props.getOnChainFeeEstimates(); | ||
| } | ||
|
|
||
| componentWillReceiveProps(nextProps: Props) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh React, always deprecating lifecycles... Thanks for the heads up! We can probably let this one slip since we're using this lifecycle in quite a few places, and can just do one big refactor when we come around to v17.
|
hey @wbobeirne I am traveling and wont be able to make any changes to this branch until this weekend. Feel free to make any additional updates you think are improvements. Great feedback @otech47, thank you very much. |
* Make FeeSelectField a controlled component
* Show number when hovered over labeled fee estimates
* Fix ChainSend automatic fee calculation
|
No worries, hope it's somewhere sunny. I just pushed changes to address the feedback, and merged develop back in to fix the snyk CI. If you don't get a chance to review, I'll probably merge as is since I tested it pretty thoroughly and it all LGTM. |
|
@wbobeirne Thanks for cleaning this up and getting it merged 👍 |

Closes #181
Description
Adds a new field to the Open Channel form giving the option to choose the transaction speed. This will set the sats/byte to a predetermined value based on the current BTC mainnet mempool.
Note: Fee estimates are only provided for BTC so this field is hidden when connected to an LTC node
Steps to Test
Open channelfrom the top right nav menuShow advanced fieldsbutton in the modalOpen Channelbutton to send the transactionScreenshots