1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
Commit Graph

4035 Commits

Author SHA1 Message Date
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
Dan J Miller
94810ce9c9
Compare the networkId against the correct enum in eth and token overview components (#9485) 2020-10-06 17:34:53 -02:30
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
ricky
b00cd344d9
Use ethers to validate mnemonic during import (#9463) 2020-09-28 18:43:42 -02:30
Brad Decker
b3d3518bc0
Remove unnecessary functions (#9458)
Removes unnecessary functions with minor code changes to support extraction
2020-09-24 11:42:56 -05:00
Brad Decker
e75bfc4dbc
remove-unused-component (#9457) 2020-09-23 13:11:22 -05:00
Brad Decker
37cbeb56a3
make gas edit tooltips use Tooltip (#9434) 2020-09-17 17:05:31 -05:00
Thomas Huang
ee6e986f59
Fix dismiss button css on unconnected alert modal (#9430)
* Fix dismiss button on unconnected alert modal

Set button type to primary, rounded, and set `!important` on css class width

* Update ui/app/components/app/alerts/unconnected-account-alert/unconnected-account-alert.scss

* Add unconnected-account-alert to popover component classname to simplify css selector.

Co-authored-by: Brad Decker <git@braddecker.dev>
2020-09-17 13:23:37 -07:00
Erik Marks
550e49a64c
Gas modal styling fixes (#9433) 2020-09-17 13:02:00 -07:00
Brad Decker
c6a540419c
fix styles on tx detail popover buttons (#9432) 2020-09-17 12:12:42 -05:00
Brad Decker
f4a2a09713
increase specifity of button style overrides on notifications (#9427) 2020-09-17 09:08:02 -05:00
Brad Decker
1123adcb1d
fix overflow issue on approval container (#9415) 2020-09-16 15:18:39 -05:00