-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Dapp Transaction Confirmation Re-designs #1559
Conversation
8a38295
to
dd4ed7a
Compare
12d3484
to
5443d20
Compare
90a451b
to
d48dc94
Compare
a10507b
to
14915b1
Compare
@estebanmino please let me know if this implementation is okay. I haven't chopped any components, although it's possible that there is some lingering redundant code. |
d48dc94
to
e7c03ea
Compare
892be43
to
ec866d1
Compare
app/components/Nav/Main/index.js
Outdated
@@ -1143,6 +1155,7 @@ class Main extends PureComponent { | |||
{this.renderSigningModal()} | |||
{this.renderWalletConnectSessionRequestModal()} | |||
{this.renderWalletConnectReturnModal()} | |||
{this.state.dappTransactionModalVisible && this.renderDappTransactionModal()} |
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.
isn't this hiding the component as https://github.com/MetaMask/metamask-mobile/pull/1559/files#diff-bf0cd540666d1b6f43322fe31ec18ffbR1132 ?
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.
Yes, looks like it's doing the same thing
const fromAccount = this.props.accounts[checksummedFrom]; | ||
if (fromAccount && isBN(gas) && isBN(gasPrice) && hexToBN(fromAccount.balance).lt(gas.mul(gasPrice))) | ||
return strings('transaction.insufficient'); | ||
if (hexToBN(fromAccount.balance).lt(gas.mul(gasPrice).add(value))) return strings('transaction.insufficient'); |
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 believe hexToBN(fromAccount.balance).lt(gas.mul(gasPrice).add(value))
includes hexToBN(fromAccount.balance).lt(gas.mul(gasPrice)))
from this line right?
I mean if gas.mul(gasPrice).add(value)
therefore gas.mul(gasPrice)
, we are comparing to times this, converting and comparing BN
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.
Right, it's redundant
style={styles.gasInput} | ||
onChangeText={this.onGasLimitChange} | ||
//useing BN here due to a glitch that causes it to sometimes render as x.00000001 | ||
value={customGasLimitBN.toString()} |
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 think I have many problems with converting BN to strings or number before, you didn't have any issue?
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 problems at all
keyboardType="numeric" | ||
style={styles.gasInput} | ||
onChangeText={this.onGasPriceChange} | ||
value={customGasPrice.toString()} |
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.
same comment above, assuming is a BN
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.
worked fine unless I've missed something
app/components/UI/CustomGas/index.js
Outdated
renderGasError = () => { | ||
const { warningGasLimit, warningGasPrice, warningSufficientFunds } = this.state; | ||
const { gasError } = this.props; | ||
const hideError = !warningGasLimit && !warningGasPrice && !warningSufficientFunds && !gasError; |
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.
isn't this equal to ! gasErrorMessage
from the line below? you could use it directly here without crating a const
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.
Indeed, fixed
<View style={styles.label}> | ||
<Text style={styles.labelText}>{strings('transaction.review_function_type')}</Text> | ||
<Text style={styles.functionType}>{actionKey}</Text> | ||
<Text style={styles.labelText}>{strings('transaction.review_function')}: </Text> |
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 think you missed the :
at the end
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.
Seems to work fine
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.
Overall looks great. Left some small comments and one related to BN numbers being handled on the render method, I'm almost sure I've has issues with that before, but not completely sure so I wanted to ask
8d783bb
to
18a47ff
Compare
ec866d1
to
2fdb65a
Compare
1900922
to
7b77976
Compare
f3a316d
to
ae7579c
Compare
ae7579c
to
f6d7eb1
Compare
…ISF), unlocks going back from custom gas modals if error is present
…tal value now passed down as view or text component
…lVisible to redux, use in Send to close dapp tx modal (if it's open) to fix send deeplink tx data getting wiped
4f6d250
to
e1c0f24
Compare
* Nav/Main: dappTransactionModalVisible in state & toggleDappTransactionModal function, render Approve directly instead of using navigation * Approval: stop using navigation API, instead hide or show the modal. Render a modal with TransactionEditor & TransactionHeader, getUrlFromBrowser helper added for TransactionHeader * TransactionEditor: use react fragment in place of view, remove styles * Approval: move out TransactionHeader and root style * TransactionEditor: move in root styles, different for txEdit and txReview * TransactionReview: Use TransactionHeader, remove ActionView * TransactionReviewSummary: use WarningMessage component * TransactionReviewSummary: styling for function indicator and amount summary * TransactionReviewSummary: remove flex style, fix paddings * TransactionReview: use AccountInfoCard * Fix merge glitches * TransactionReview: take state and functionality from TransactionReviewSummary, pass props * TransactionReviewFeeCard: use padding instead of width percentage * TransactionReview: remove renderTransactionDetails, render TransactionReviewInformation directly * TransactionReviewSummary: fix proptypes * TransactionReviewInformation: remove overview style, fix styles for error, add assetAmount, fiatValue & primaryCurrency props, render TransactionReviewFeeCard * TransactionReviewInformation: add View Data button * TransactionReview: toggleDataView & dataVisible in state, render review info if dataVisible false, else render empty view for now * TransactionReview: change toggleDataView to arrow fn * Locales: add transaction.view_data * TransactionReviewInformation: fix touch area for view data button * TransactionReview: re-add ActionView, fix it's height based on screen size, fix error message * TransactionEditor: ensure dynamic modal height * Locales: add review_data, data, review_function * TransactionReviewData: implement design, use toggleDataView from props to go back * TransactionReview: use TransactionReviewData, pass toggleDataView to props * TransactionEdit: strip down, remove everything and render CustomGas with props * UI/CustomGas: fix styling + logic to mimic SendFlow/CustomGas, only handle selector gas price change upon clicking save, use renderGasError * CustomGas: fix loader * SendFlow/CustomGas: Add comment for fix in transaction-components * locales: add custom_gas.total * UI/CustomGas: use local error validation, only handle gas fee on save button press * snapshot/test updates * Approval: fix lint error * TransactionReviewSummary: change primary value based on primary currency * TransactionReview: pass props to TransactionReviewSummary * snapshots & tests * UI/CustomGas: fix custom gas selector button locking if initial NSF error * snapshot * TransactionEdit: can change mode to review even if gas error (namely ISF), unlocks going back from custom gas modals if error is present * snapshot gravy * Feedback updates * Design fixes * locales: change data description text * snapshot * TransactionReviewData: add Hex data title * locales: change hex data * snapshot update yo * CustomGas: remove redundant setstate calls * TransactionReview: tweak style of hex data and add bold text * TransactionReviewFeeCard: fix rendering problem with ERC20 tokens, total value now passed down as view or text component * snapshot updatessss * Send, Nav/Main: move toggleDappTransactionModal & dappTransactionModalVisible to redux, use in Send to close dapp tx modal (if it's open) to fix send deeplink tx data getting wiped * Fix stubborn tab/spacing lint error
Redesigns for
Approval
or dApp confirmation flow for transactions.Checklist
Approval
: change to ModalIssue
Resolves #1501
Resolves: #1499