1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-23 03:36:18 +02:00
Commit Graph

3953 Commits

Author SHA1 Message Date
David Walsh
ec70f33eca
Try disable swap button so it cannot be focused (#9602) 2020-10-14 14:16:14 -02:30
David Walsh
d0152aad51
Use localizations for placeholders in Swap (#9587) 2020-10-14 14:15:44 -02:30
David Walsh
48dd3fe069
AutoFocus the from input on swaps screen (#9581) 2020-10-14 14:13:55 -02:30
David Walsh
bbd4ee5fdf
Autofocus the appropriate text fields in the Create/Import/Hardware screen (#9576) 2020-10-14 14:13:26 -02:30
David Walsh
674107da3f
Ensure proper hover display for accounts in main menu (#9575) 2020-10-14 14:13:09 -02:30
Dan J Miller
2563180a88
Data consistency swaps token balance (#9588)
* Explicitly set balance and string on the swaps from token in token-overview

* Set swapsFromToken balance to a decimal instead of a hex on eth balance change in build-quote
2020-10-14 14:09:04 -02:30
Mark Stacey
e53f970458
Use localized strings for MetaMetrics opt-in page (#9593)
The MetaMetrics opt-in page during onboarding now uses localized
strings. This allows us to add translations.
2020-10-14 13:33:34 -02:30
Thomas Huang
38a0c5ec75
Fix FF overflow list-item right-content/primaryCurrency wrapper (#9591)
Over flow .list-item__right-content rather than the text.
2020-10-13 21:45:21 -07:00
Mark Stacey
7a1d93002d
Remove commitment to maintain a public metrics dashboard (#9592)
We were unable to deliver this public dashboard as we had originally
anticipated, and this is no longer a priority for the team. We may
revisit this idea in the future, but for now it has been removed from
our list of commitments.
2020-10-13 22:16:02 -02:30
Erik Marks
59212f7a2b
Remove dead gas estimation functions, rename function (#9579) 2020-10-13 14:13:54 -07:00
Dan J Miller
dfb722b6ed
Hex prefix newly fetched token balances in build-quote (#9586)
* Hex prefix newly fetched token balances in build-quote

* Set balance to dec WEI string instead of hex when adding token via swap from select
2020-10-13 17:38:24 -02:30
Mark Stacey
c11b7cc5ea
Update setRpcTarget parameter name (#9585)
The `network` parameter of `setRpcTarget` was changed to `chainId` in
a recent commit, but there was an interim variable that we forgot to
rename.
2020-10-13 16:37:29 -02:30
Dan J Miller
00c8609f95
Add data point to 'Swaps Completed' segment event: estimated vs used gas (#9571)
* Add data point to 'Swaps Completed' segment event: estimated vs used gas

* Linted

* Correct property name for estimated gas on swapMetaData in _trackSwapsMetrics()

* Set estimated_gas property on swapMetaData to a hex string

* Correct base when dividing by estimated_gas

Co-authored-by: Dan Finlay <dan@danfinlay.com>
2020-10-13 16:11:26 -02:30
Whymarrh Whitby
8c989cd777
Mark sendToken as optional in constructTxParams docs (#9561)
[skip e2e]
2020-10-13 11:45:33 -02:30
Mark Stacey
ded43cbcdf
Remove unused code (#9564)
A number of unused parameters and `propTypes` have been merged, along
with an unused function.
2020-10-13 11:18:22 -02:30
Erik Marks
e071b4482e
Use chainId values for the address book (#9565)
* Delete CachedBalancesController.cachedBalances

* Migrate provider to Rinkeby instead of deleting it

* Convert hex transaction metamaskNetworkId values to decimal

* Don't migrate provider state in e2e tests

* Don't kick custom RPC users to Rinkeby unnecessarily

* Use provider.chainId for address book chainId values

* Add address book migration

* Fix failing unit test

* fixup! Merge branch 'develop' into address-book-use-chainId

* Select address book entries for display by chainId

* Merge all address book entry keys

* fixup! Merge all address book entry keys
2020-10-12 16:35:55 -07:00
David Walsh
a5ff8aff80
Prevent undefined class from being added to Tabs (#9563) 2020-10-12 20:50:00 -02:30
David Walsh
a3b434df46
Autofocus first input for Search Token and Custom Token (#9562) 2020-10-12 14:10:51 -07:00
Dan J Miller
f3bd717184
Account for approval gas costs in eth received (#9559)
* Account for approval gas costs in eth received

* Pass approval txMeta to getSwapsTokensReceivedFromTxMeta in swaps/index.js
2020-10-12 17:26:53 -02:30
Erik Marks
5b8c07817a
Remove localhost provider type (#9551)
* Delete localhost provider type

* Use ganache-cli default chain ID for tests

* Delete unused test firstTimeState variable

* Migrate default ganache-cli network to frequentRpcListDetail

* Add default test provider state

* Add test functionality to createJsonRpcClient

* Lint locales

* Update test middleware creation

* fixup! Update test middleware creation
2020-10-12 12:05:40 -07:00
Dan J Miller
33b755fa66
Update #2 to the MetaSwap contract address (#9557) 2020-10-12 14:50:37 -02:30
Dan J Miller
0e37904692
Add useFastestButtons options to gas-customization modal and utilize it in swaps. (#9548) 2020-10-12 14:21:17 -02:30
Dan J Miller
a9d156e611
Fix and simplify account switching in Swaps (#9549)
* Ensure rendered swap from token balance updates when token balance changes

* Disable account switching on all swaps routes other than build quote
2020-10-12 14:21:01 -02:30
Dan J Miller
dc5edb5431
Fix calculation and display of eth received amounts in swaps (#9546)
* Update txMeta after postTxBalance has been retrieved

* Use gas used from txReceipt to calculate eth received

* Return null from getSwapsTokensReceivedFromTxMeta in tokenSymbol is ETH and txReceipt is missing

* Get latest txMeta before updating it with postTxBalance in case of a swaps tx in confirmTransaction

* Lint fix
2020-10-12 07:52:51 -02:30
Dan J Miller
6409caa081
Use initial transaction for settings swap transaction title params (#9543)
* Use initial transaction for settings swap transaction title params, and remove addition of swap properties to cancel transcations

* Update unit test data

* Use token symbol properties from initial transaction for filitering in transaction list
2020-10-10 17:20:20 -02:30
Thomas Huang
ac8f673716
Overflow primaryCurrency in tx-list-item & use primaryCurrency for tx breakdown details. (#9539)
* Set result of calcTokenAmount to base 10 string in useTokenDisplayValue

* Use primaryCurrency for amount in transaction breakdownd details

* Hidden overflow and text overflow ellipsis on long primary currency in transaction-list-item

* Empty prefix for token approvals

* Conditional render primaryCurrency title in tx breakdown to `Spend limit amount` when tx is a token approve.

* Add title to primaryCurrency in tx list item to show full amount on hover

* Update ui/app/components/app/transaction-breakdown/transaction-breakdown.component.js

DRY title conditional rendering.

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-10-09 13:11:39 -07:00
Erik Marks
24d7d1ae2a
Parse inputs to BigNumber arithmetic in conversion util (#9502) 2020-10-09 13:01:15 -07:00
Dan J Miller
436b01387c
Add useSwapsEthToken hook and utilize wherever we need the ETH 'token' for swaps (#9537)
* Add useSwapsEthToken hook and utilize wherever we need the ETH 'token' for swaps
* Remove rawEthTokens param from useTokensToSearch calls

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Erik Marks <rekmarks@protonmail.com>
2020-10-09 12:17:56 -07:00
Mark Stacey
d8818a47c4
Add margins between quote list columns (#9528)
The quote list columns have been adjusted to add more space in between
the columns. Additionally, the third column cells are now better
aligned under the header. A few unnecessary `<div>`s and CSS classes
have been removed as well.
2020-10-09 16:12:13 -02:30
Mark Stacey
4505ab5f2b
Update error message for missing substitutions (#9541)
This updated error message shows the key of the message instead of the
message text itself, followed by the locale code.

This will make it easier to filter messages we want to ignore in
Sentry. Currently it's difficult to filter because the message is
radically different for each locale. With this change, we can add a
filter and use a glob for the last part to filter it for all locales.

It's still important to include the locale code in the message, so that
we can catch cases where the message has the wrong number of
substitutions for a specific locale.
2020-10-09 14:22:51 -02:30
Dan J Miller
0ebc465221
Fix swap prop type errors (#9532)
* Fix swap prop type errors

* Fix prop type of sortColumn in sort-list
2020-10-09 13:08:01 -02:30
Dan J Miller
98f049f8cb
Only shows the swaps intro popup on mainnet (#9534)
* Only shows the swaps intro popup on mainnet

* Remove code that closes swaps popup from e2e tests

* correct casing on isMainnet prop in home component
2020-10-09 13:07:11 -02:30
Dan J Miller
89a0f75942
Corrects the copy in the amount receiving tooltip of the swaps sort-list (#9533) 2020-10-09 12:30:16 -02:30
Dan J Miller
549140f6f5
Remove max mode for eth feature from swaps (#9531)
* Remove max mode for eth feature from swaps

* Fix unit tests after removing maxMode from swaps
2020-10-09 12:26:23 -02:30
David Walsh
a301ce92d8
Prevent duplicate increment/decrement buttons in Firefox (#9523)
Fixes #9516
2020-10-08 14:53:14 -02:30
Mark Stacey
305e3ceb2e
Fix retry transaction button tooltip (#9524)
The tooltip for the Retry Transaction button would be erroneously set
to display a custom block explorer, if one was set for the current
network. It now displays the intended retry transaction text in all
cases.
2020-10-08 14:30:41 -02:30
David Walsh
25e5ac24b2
Prevent swaps value input placeholder from jumping when focused (#9520) 2020-10-08 13:38:36 -02:30
Dan J Miller
e389ad98af
Hide activity list retry button for failed swaps transctions (#9513) 2020-10-08 11:41:05 -02:30
Dan J Miller
a939853989
Ensure all of a token is swapped when clicking max in swaps (#9507) 2020-10-07 18:38:34 -07:00
Mark Stacey
cdfa2e66fd
Hide retry button for on-chain failures (#9506)
On-chain failed transactions have a transaction status of `confirmed`,
and should not be retried. Our retry function doesn't handle on-chain
failures yet, so it would inevitably fail due to the transaction having
the same nonce as a confirmed on-chain transaction.

When determining whether to show the retry button in the UI, we had
mistakenly been using a `status` variable that determined whether we
should show "Failed" on that transaction in the activity log. That
display status includes both network and on-chain failures, unlike
the `txMeta.status` property.

The `showRetry` logic has been updated to ensure it's only shown when
`txMeta.status` is `failed`, meaning on-chain failures will no longer
show the retry button. Additionally, the display-specific `status`
variable has been renamed to `displayedStatusKey`, to indicate that it
is a string that corresponds to a localized message, and that it's the
status meant for display purposes.
2020-10-07 14:59:38 -07:00
Dan J Miller
392f9eafc2
Stop passing a gas param to the estimateGas call initiated in the swaps controller (#9501)
* Stop passing a gas param to the estimateGas call initiated in the swaps controller timedoutGasReturn

* Stop passing gas params to timedoutGasReturn

* Lint fix

* Stop passing no longer used param to setInitialGasEstimate
2020-10-07 16:30:17 -02:30
Dan J Miller
7a28783924
Prevent user from submitting swap if they do not have enough for the max gas fee (#9500) 2020-10-07 09:55:38 -07:00
Mark Stacey
b98b0b6d01
Fix missing app header on Home screen (#9498)
The app header would sometimes mistakenly not get rendered while on the
Home screen. This could happen when a permission request was made while
the UI was open, to either the browser action popup or the fullscreen
UI.

This was caused by faulty logic in the top-level router component. It
would hide the app header if there was a pending permission request,
presumably because the author assumed that a redirect to the permission
flow would shortly follow. This redirect only happens on mount though,
not if the UI was already open when the permission request was
submitted.

The intent of this logic was to hide a brief flash of the app header
prior to rendering the permission flow. This brief flash has now been
restored, which is unfortunate, but is better than the missing app
header bug. We can revisit a solution to removing this flash in the
future, hopefully in a manner that avoids this bug and works for all
notification UI cases.
2020-10-07 14:15:39 -02:30
Brad Decker
9230d75ab0
pass entire tokenData object to getTokenAddressParam (#9499) 2020-10-07 11:40:39 -05:00
Mark Stacey
d1e8f5db86
Prevent redirecting to swaps in notification (#9497)
If a notification popup was opened while the user was partway through
the swaps flow, the notification would display the swaps flow instead
of whatever action triggered the popup (e.g. a connect request or a
confirmation). This is confusing and potentially dangerous, as the
user might mistakenly think the swap was triggered by a dapp.

The swap redirects are now prevented in the notification UI. The user
will still be redirected to an in-progress swap flow if they open the
browser action popup or the fullscreen UI, but not on the notification
popup that is triggered by dapp actions.
2020-10-07 13:49:47 -02:30
Erik Marks
bf1bb6ca7e
Check specified chain ID against endpoint return value (#9491)
Adds additional validation to chainId values in the network form, by comparing the specified value against the value returned by the endpoint.
2020-10-07 11:58:22 -02:30
Brad Decker
1ba4061f46
format quotes consistently on main-view and list-view (#9495) 2020-10-06 22:07:38 -02:30
Dan J Miller
534ac25a93
Ensure gas costs are accounted for when calculating the amount of eth received in a swap (#9494) 2020-10-06 21:38:09 -02:30
Erik Marks
46bcba2d63
Fix IconButton prop type (#9489)
* Fix IconButton prop type
2020-10-06 14:09:12 -07:00
Erik Marks
39d5bb73a7
Remove setSpecialRpc functionality (#9490) 2020-10-06 14:06:41 -07:00