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

525 Commits

Author SHA1 Message Date
Mark Stacey
f4838194d6
Remove unused customGasLimit parameter (#9656)
This parameter to the `quotesToRenderableData` function was never
passed in. It has been removed.
2020-10-20 10:36:00 -02:30
Mark Stacey
97450cd8fd
Remove non-existent metaMaskFee property (#9657)
The `metaMaskFee` property on the "quote data" PropType was not used,
and it never existed in practice. This resulted in PropType errors.

The non-existent property has been removed.
2020-10-20 10:35:34 -02:30
Erik Marks
edefdc4ede
Fix estimated network fee line split (#9648) 2020-10-19 20:59:31 -02:30
Mark Stacey
4cab30eae1
Remove duplicate percent sign from MetaMask fee (#9647)
The MetaMask fee is shown with two percent signs on the view quote page, because the percent sign is embedded in the fee amount as well as in the localized message.

The fee amount used now comes from the API, and does not have a percent sign. The percent sign is now only in the localized message. This allows for different locales to display the percentage differently. The old hard-coded value with a percent sign embedded has been removed, as it is no longer used anywhere.
2020-10-19 20:58:48 -02:30
Dan J Miller
43d97ebe4f
getStatusKey to return an empty string when passed a falsy value (#9640) 2020-10-19 18:29:48 -02:30
Dan J Miller
c8526bc687
Update view-quote designs to better represent the metamask fee (#9633)
* Update view-quote designs to better represent the metamask fee

* Code clean up

* Copy updates
2020-10-19 17:15:32 -02:30
Dan J Miller
b1adc0d1e8
Fix use transaction time remaining (#9630)
* Only format timeRemaining if in useTransactionTimeRemaining if it is truthy

* Only setTimeRemaining in useTransactionTimeRemaining if submitted time is a number

* Use isSubmitted as a check, instead of isPending and submittedTime, before calculating timeRemaining
2020-10-19 12:15:21 -02:30
Dan J Miller
7925a767b8
Add a minimumGasLimit to the original gas customization modal (#9623)
* Add a minimumGasLimit to the gas customization modal in swaps

* Update app/_locales/en/messages.json

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

* Set default for minimum gas limit in gas-modal-page-container.container and make required in sub components

* Update unit tests

* Default value for minimumGasLimit in advanced-gas-inputs.component.js

* Preserve existing gasLimitTooLow message key by creating new gasLimitTooLowWithDynamicFee

* Fix failing unit test

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Erik Marks <rekmarks@protonmail.com>
2020-10-19 10:41:23 -02:30
Dan J Miller
397e3a2c7f
Update swaps network fee tooltip (#9614)
* Update network fee tooltip in fee-card to match latest designs

* Clean up css classes and div
2020-10-19 05:54:59 -02:30
Dan J Miller
e546314e3f
Update fee card storybook to utilize latest fee-card api (#9613)
* Update fee card storybook to utilize latest fee-card api

* Update ui/app/pages/swaps/fee-card/fee-card.stories.js

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-10-16 13:29:32 -02:30
David Walsh
971f5b0056 Fix #9577 - Use contained button type for unlock button 2020-10-15 10:36:15 -05:00
Dan J Miller
af018a2d74
Clear all gas slice state on entering and leaving swaps (#9609) 2020-10-14 21:50:37 -02:30
Dan J Miller
0558689636
Compare convert ethBalance to decimal before comparing to fromTokenBalance in useEffect for eth token balance update (#9607) 2020-10-14 16:48:21 -02:30
Erik Marks
c39617e111
Make FeeCard component specific to swaps (#9603)
* Make FeeCard component specific to swaps

* Fix some prop types
2020-10-14 11:59:03 -07:00
Erik Marks
a0d7aa56aa Loosen isBestQuote PropType 2020-10-14 10:17:41 -07:00
Erik Marks
799df99bd0 Rename some props 2020-10-14 10:12:35 -07:00
Erik Marks
b31816d6f7 Make FeeCard component specific to swaps 2020-10-14 10:06:17 -07:00
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
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
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
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
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
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
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
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
25e5ac24b2
Prevent swaps value input placeholder from jumping when focused (#9520) 2020-10-08 13:38:36 -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
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
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
39d5bb73a7
Remove setSpecialRpc functionality (#9490) 2020-10-06 14:06:41 -07:00
Dan J Miller
30d13422b5
Add MetaMask Swaps (#9482) 2020-10-06 15:58:38 -02:30
Erik Marks
088d4c34f1
Merge pull request from GHSA-c2xw-px2x-pr65
* Remove network config store
* Remove inline networks variable in network controller
* Re-key network controller 'rpcTarget' to 'rpcUrl'
* Require chainId in lookupNetwork, implement eth_chainId
* Require chain ID in network form
* Add alert, migrations, and tests
* Add chainId validation to addToFrequentRpcList
* Update public config state selector to match new network controller
state
* Use network enums in networks-tab.constants
* Ensure chainId in provider config is current
* Update tests
2020-10-06 15:27:02 -02:30