Skip to content
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

Add hex data input to send screen #4814

Merged
merged 6 commits into from
Jul 18, 2018
Merged

Conversation

whymarrh
Copy link
Contributor

Fixes #3430

This PR adds the ability to edit the hex data for a tx when sending it.

shouldComponentUpdate (nextProps, nextState, nextContext) {
const {data, inError} = this.props
const {nextData, nextInError} = nextProps
return data !== nextData || inError !== nextInError
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldComponentUpdate isn't needed because these are primitive values


return (
<SendRowWrapper
label={`${this.context.t('hexData')}:`}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Destructure this.context

txParams: Object.assign(
unapprovedTx.txParams,
addHexPrefixToObjectValues({data}),
addHexPrefixToObjectValues({data: unapprovedTx.txParams.data}),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't particularly clear and needs explanation—why is this needed?

onInput = (event) => {
const {updateSendHexData} = this.props
event.target.value = event.target.value.replace(/\n/g, '')
updateSendHexData(event.target.value)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If value is an empty string we should be removing the data

@whymarrh whymarrh merged commit 76ac6bb into MetaMask:develop Jul 18, 2018
@whymarrh whymarrh deleted the send-data branch July 18, 2018 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants