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

Dapp Transaction Confirmation Re-designs #1559

Merged
merged 54 commits into from
Jul 7, 2020
Merged

Conversation

EtDu
Copy link
Contributor

@EtDu EtDu commented May 12, 2020

Redesigns for Approval or dApp confirmation flow for transactions.

Checklist

  • Approval: change to Modal
  • Implement modal design
  • Ensure transactions work properly after redesign
  • Tie in Custom Gas

Issue

Resolves #1501
Resolves: #1499

@EtDu EtDu changed the base branch from develop to transaction-components May 12, 2020 07:04
@EtDu EtDu marked this pull request as draft May 12, 2020 13:11
@EtDu EtDu force-pushed the transaction-components branch from 8a38295 to dd4ed7a Compare May 14, 2020 06:41
@EtDu EtDu force-pushed the dapp-confirmation-designs branch from 12d3484 to 5443d20 Compare May 14, 2020 13:41
@EtDu EtDu force-pushed the transaction-components branch from 90a451b to d48dc94 Compare May 18, 2020 09:53
@EtDu EtDu force-pushed the dapp-confirmation-designs branch from a10507b to 14915b1 Compare May 18, 2020 10:03
@EtDu
Copy link
Contributor Author

EtDu commented May 19, 2020

Screen Shot 2020-05-16 at 1 53 36 PM

Screen Shot 2020-05-19 at 8 32 10 PM

Screen Shot 2020-05-16 at 4 04 47 PM

Screen Shot 2020-05-17 at 2 52 53 PM

Screen Shot 2020-05-16 at 4 10 37 PM

Screen Shot 2020-05-16 at 1 53 58 PM

Screen Shot 2020-05-19 at 8 29 39 PM

@EtDu EtDu marked this pull request as ready for review May 19, 2020 13:31
@EtDu
Copy link
Contributor Author

EtDu commented May 22, 2020

@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.

@EtDu EtDu force-pushed the transaction-components branch from d48dc94 to e7c03ea Compare May 22, 2020 11:25
@EtDu EtDu force-pushed the dapp-confirmation-designs branch from 892be43 to ec866d1 Compare May 22, 2020 11:34
@omnat
Copy link
Contributor

omnat commented May 22, 2020

Confirm transactions

@@ -1143,6 +1155,7 @@ class Main extends PureComponent {
{this.renderSigningModal()}
{this.renderWalletConnectSessionRequestModal()}
{this.renderWalletConnectReturnModal()}
{this.state.dappTransactionModalVisible && this.renderDappTransactionModal()}
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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');
Copy link
Contributor

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

Copy link
Contributor Author

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()}
Copy link
Contributor

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?

Copy link
Contributor Author

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()}
Copy link
Contributor

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

Copy link
Contributor Author

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

renderGasError = () => {
const { warningGasLimit, warningGasPrice, warningSufficientFunds } = this.state;
const { gasError } = this.props;
const hideError = !warningGasLimit && !warningGasPrice && !warningSufficientFunds && !gasError;
Copy link
Contributor

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

Copy link
Contributor Author

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>
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems to work fine

Copy link
Contributor

@estebanmino estebanmino left a 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

@EtDu EtDu force-pushed the transaction-components branch from 8d783bb to 18a47ff Compare May 28, 2020 11:00
@EtDu EtDu force-pushed the dapp-confirmation-designs branch from ec866d1 to 2fdb65a Compare May 28, 2020 12:27
@EtDu EtDu requested a review from a team as a code owner May 28, 2020 12:27
@estebanmino estebanmino added the needs-qa Any New Features that needs a full manual QA prior to being added to a release. label May 28, 2020
@EtDu EtDu force-pushed the transaction-components branch from 1900922 to 7b77976 Compare June 2, 2020 08:52
@EtDu EtDu force-pushed the dapp-confirmation-designs branch from f3a316d to ae7579c Compare June 2, 2020 09:01
Base automatically changed from transaction-components to develop June 9, 2020 05:25
@EtDu EtDu force-pushed the dapp-confirmation-designs branch from ae7579c to f6d7eb1 Compare June 9, 2020 05:45
@EtDu EtDu force-pushed the dapp-confirmation-designs branch 2 times, most recently from 4f6d250 to e1c0f24 Compare July 5, 2020 04:56
@EtDu EtDu merged commit 0c7a192 into develop Jul 7, 2020
@EtDu EtDu deleted the dapp-confirmation-designs branch July 7, 2020 03:57
rickycodes pushed a commit that referenced this pull request Jan 31, 2022
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next release QA Passed A successful QA run through has been done
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Complete redesign for transactions created from dapps Create transaction data modal
5 participants