-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Ensure smart contract interactions are properly represented on the confirm screen #15446
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
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
| const RECIPIENT_TYPES = { | ||
| SMART_CONTRACT: 'SMART_CONTRACT', | ||
| NON_CONTRACT: 'NON_CONTRACT', | ||
| }; |
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.
Love this.
brad-decker
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.
Good work!
ui/ducks/send/send.js
Outdated
| if (smartContractAddress) { | ||
| dispatch(actions.updateRecipientType(RECIPIENT_TYPES.SMART_CONTRACT)); | ||
| } | ||
| if (smartContractAddress) { |
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.
is there a reason you made a new if (smartContractAddress) conditional? The same if statement is right below on line 1892?
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.
uh, no... I originally had this outside the if block two lines above, and then copy pasted it to here, will refactor
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.
changed in latest commit
ui/ducks/send/send.js
Outdated
| useTokenDetection, | ||
| tokenAddressList, | ||
| isProbablyAnAssetContract, | ||
| smartContractAddress, |
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.
is this being used? Sorry If I'm missing it? validateRecipientUserInput doesn't appear to make use of it?
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.
no, will remove
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.
removed
ui/ducks/send/send.js
Outdated
|
|
||
| const inputIsValidHexAddress = isValidHexAddress(userInput); | ||
| let isProbablyAnAssetContract = false; | ||
| let smartContractAddress; |
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.
since this is not longer passed to the validation method this can go back to being a const inside the if (inputIsValidHexAddress) { conditional
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.
done
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.
linting should tell me this stuff
adonesky1
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.
Not a blocker since we're trying to get this out the door but lets note that we should make test cases for this?
Absolutely. I am preparing tests for PRs I have merged over the past couple of day, and will submit another PR for those |
Builds ready [a3e5d45]
Page Load Metrics (1711 ± 57 ms)
highlights:storybook
|
Fixes: #15413
The problem was that we were representing a contract interaction as a simple send when first arriving at the confirm screen. The solution is to ensure that if we are sending to a contract address, we apply the contract interaction type to the transaction when creating it from the send screen.
Some other changes were needed to get this fully working:
TRANSACTION_TYPES.CONTRACT_INTERACTIONas a valid transaction type when adding a new unapproved transactionisSmartContractAddressfunction which was previously broken because it was attempting to get the wrong property from the result ofreadAddressAsContract()Before:
after-aug3-1250.mp4
After:
after-aug3-1246.mp4