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

204 Commits

Author SHA1 Message Date
Alex Miller
722c4e5b63
Support for GridPlus Lattice1 hardware wallet (#12053)
* GridPlus: Adds support for GridPlus Lattice1 hardware wallet

* Fixes issue with switching hardware HD path
The main `Select HD Path` piece of the account selection component was not
properly hooked up to the state manager (`onPathChange`) and the extra
`Popover` component was being used instead.
I'm not sure what the origin of this is, but I don't see why the Popover
is needed at all. I have remove it and hooked `onPathChange` directly into
the HD path selector dropdown.
This was an issue that nearly every Lattice user who had come from Ledger
has contacted us about.

* GridPlus: Addresses QA issues
* Adds Lattice tutorial + image
* Cleans up connectivity issues (see: https://github.com/GridPlus/eth-lattice-keyring/pull/16)

* GridPlus: Adds Firefox support
To connect to the Lattice you need to open a new tab/window and get
login data from it. We were not able to do this for Firefox because
we relied on the `window` API. This is now fixed.
See corresponding changes:
* `eth-lattice-keyring`: https://github.com/GridPlus/eth-lattice-keyring/pull/17
* Lattice connector: https://github.com/GridPlus/wallet-web/pull/152

* GridPlus: Adds missing error path for Firefox
See: 242a93f559
2021-11-08 11:18:41 -03:30
Dan J Miller
843bb6e047
Check if ledger was successfully able to establish transport on confirm screen mount (#12535)
* Check if ledger was successfully able to establish transport on mount of confirm screens

* Update ledger message/action if transport creation was blocked by existing connection

* TEMP: point eth-ledger-bridge-keyring to commite, REMOVE BEFORE MERGE

* Update eth-ledger-bridge-keyring to v0.10.0
2021-11-04 15:49:53 -02:30
igorms-cons
59054519ba
Show account name & full address in send view - issue #12346 (#12415)
* account name & address in send view UI update & fix

* update scss in send modal view

* send account address - refacto func
2021-11-04 04:28:32 -02:30
Olusegun Akintayo
b6673731e2
Implement Network Switcher designs (#12260)
* Show test networks toggle button in settings/advanced tab.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Apply toggle testnet settings and show/hide testnets when on/off
Add localhost to testnet.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Lint fixes.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Show add network button

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Open full screen when add network is called.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Show custonm rpc before testnet rpcs
lint fixes.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Test cases for network dropdown.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Test cases for toggle test networks in advanced tab component.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Lint fixes.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Fix Locales.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* E2E Tests: Custom RPC is now called Add Network

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Lint fix

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* E2E: When Add Network button is clicked, wait for the full screen window to
be visible

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* findVisibleElement should use a class. i.e start with a dot

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Hide Dropdown when Add Netwok is clicked.
Only show full screen if it's not already showing.
E2E tests passing.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Lint fixes

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Fix tests for jest

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Testnets are not being shown by default anymore, tests should use
Mainnet instead.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Import Button from ui
Change selector name to getShowTestnetworks
Fix button to show full width

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Fix e2e tests

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Remove localhost from INFURA provider types.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Fix errors in Advanced Tab Component tests

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Lint fixes

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Fix unit tests for advanced tab component.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Remove deleted elements from e2e tests

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Make sure all tests passed.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Lint fixes

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2021-10-28 23:31:05 +04:00
Niranjana Binoy
532927368d
Network Form Design and switch to full screen enhancements (#12302) 2021-10-25 16:38:43 -04:00
Dan J Miller
9d70c60c22
Connect Ledger via WebHID (#12411)
* Connect ledger via webhid if that option is available

* Explicitly setting preference for webhid

* Use ledgerTransportType enum instead of booleans for ledger live and webhid preferences

* Use single setLEdgerTransport preference methods and property

* Temp

* Lint fix

* Unit test fix

* Remove async keyword from setLedgerTransportPreference function definition in preferences controller

* Fix ledgelive setting toggle logic

* Migrate useLedgerLive preference property to ledgerTransportType

* Use shared constants for ledger transport type enums

* Use constant for ledger usb vendor id

* Use correct property to check if ledgerLive preference is set when deciding whether to ask for webhid connection

* Update eth-ledger-bridge-keyring to v0.9.0

* Only show ledger live transaction helper messages if using ledger live

* Only show ledger live part of tutorial if ledger live setting is on

* Fix ledger related prop type errors

* Explicitly use u2f enum instead of empty string as a transport type; default transport type to webhid if available; use constants for u2f and webhid

* Cleanup

* Wrap ledger webhid device request in try/catch

* Clean up

* Lint fix

* Ensure user can easily connect their ledger wallet when they need to.

* Fix locales

* Fix/improve locales changes

* Remove unused isFirefox property from confirm-transaction-base.container.js

* Disable transaction and message signing confirmation if ledger webhid requires connection

* Ensure translation keys for ledger connection options in settings dropdown can be properly detected by verify-locales

* Drop .component from ledger-instruction-field file name

* Move renderLedgerLiveStep to module scope

* Remove ledgerLive from function and message names in ledger-instruction-field

* Wrap ledger connection logic in ledger-instruction-field in try catch

* Clean up signature-request.component.js

* Check whether the signing address, and not the selected address, is a ledger account in singature-request.container

* Ensure ledger instructions and webhid connection button are shown on signature-request-original signatures

* Improve webhid selection handling in select-ledger-transport-type onChange handler

* Move metamask redux focused ledger selectors to metamask duck

* Lint fix

* Use async await in checkWebHidStatusRef.current

* Remove unnecessary use of ref in ledger-instruction-field.js

* Lint fix

* Remove unnecessary try/catch in ledger-instruction-field.js

* Check if from address, not selected address, is from a ledger account in confirm-approve

* Move findKeyringForAddress to metamask duck

* Fix typo in function name

* Ensure isEqualCaseInsensitive handles possible differences in address casing

* Fix Learn More link size in advanced settings tab

* Update app/scripts/migrations/066.js

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

* Update ui/pages/settings/advanced-tab/advanced-tab.component.test.js

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

* Add jsdoc comments for new selectors

* Use jest.spyOn for mocking navigator in ledger webhid migration tests

* Use LEDGER_TRANSPORT_TYPES values to set proptype of ledgerTransportType

* Use LEDGER_TRANSPORT_TYPES values to set proptype of ledgerTransportType

* Fix font size of link in ledger connection description in advanced settings

* Fix return type in setLedgerTransportPreference comment

* Clean up connectHardware code for webhid connection in actions.js

* Update app/scripts/migrations/066.test.js

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

* Update ui/ducks/metamask/metamask.js

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

* Add migration test for when useLedgerLive is true in a browser that supports webhid

* Lint fix

* Fix inline-link size

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-10-21 16:47:03 -02:30
Akintayo A. Olusegun
03e3edb00c
Refactor checking if address is contract into a new module. (#12354)
* Refactor checking if address is contract into a new module.
Tests for new module.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* addressIsContract is an async function, use await when calling it.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Lint fixes

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Mock ethQuery
change variable names
refactor in transaction.utils.
fix possible boolean destructiring.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Refactor isContractAddress boolean checks.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Lint fixes

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2021-10-20 16:12:07 +01:00
Alex Donesky
9355fb21c7
Establish onboarding-flow wrapper/router base and feature flag env variable (#12247)
* establish onboarding-flow wrapper/router base and feature flag env variable

* small cleanup

* addressing feedback
2021-09-30 16:34:11 -05:00
Jyoti Puri
6187ab9b01
Fix gas control flicker on send screen when switching between EIP-1559 networks (#12230)
Fix gas control flicker on send screen when switching between EIP-1559 networks
2021-09-30 17:27:59 +05:30
Jyoti Puri
ade9e4ac4b
Changing cancel button labels in send screen when in editing stage (#12056)
* Changing cancel button labels in send screen when in editing stage

* Re-route user to home page when reject is clicked on edit transaction page
2021-09-17 10:07:50 +05:30
Daniel
28fc2d471f
Quotes prefetching in Swaps (#11915) 2021-09-15 15:13:18 +02:00
Alex Donesky
490d3b8d40
Integrate TokensController (#11552)
* Integrate controllers/tokensController

* address rebase issues

* small cleanup

* addressing feedback

* more feedback
2021-09-10 12:37:19 -05:00
Niranjana Binoy
eb987a47b5
Integrating the TokenListController to Extension (#11398) 2021-09-09 16:56:27 -04:00
Brad Decker
ec1fd38076
remove unused sidebar component (#12048) 2021-09-09 10:14:07 -05:00
Daniel
6f0d6b1693
Add support for swaps via a direct contract for wrapping and unwrapping (#11845)
* Update contract address validations in swaps for different networks

* Add support for direct contract swaps for wrapping and unwrapping

* Add WETH_RINKEBY_CONTRACT_ADDRESS
2021-09-08 20:08:55 +02:00
ryanml
b20a77b255
Updating decimal precision to 9 (getRoundedGasPrice) (#11930) 2021-08-25 11:09:39 -07:00
Dan J Miller
e6543a83ef
Ensure transaction activity log supports EIP-1559 (#11794)
* Ensure transaction activity log supports EIP-1559

* unit test fix

* Add estimated base fee to swaps txMeta

* fix lint and tests

* Improve activity log copy
2021-08-06 19:48:53 -02:30
Dan J Miller
bfde5a1d77
Fixes updates on the confirm screen. (#11788)
* Fixes updates on the confirm screen.

* Better handling of internal send transactions

* maxFee -> maxFeePerGas property name fix

* Remove redundant setEstimateToUse call in onManualChange

* Fix unit tests

* rebase error fix

* Fixes to speedup loading and transaction breakdown priority fee

* Fix lint and unit tests

* Ensure gas price based transaction that have been customized (e.g. speed up and retry) are properly initialized in useGasFeeInputs

* Clean up

* Link fix
2021-08-06 14:31:30 -05:00
David Walsh
a0bd496d56
Restore heartbeat to transaction confirmation, use isGasEstimatesLoading more broadly (#11781) 2021-08-05 18:59:58 -05:00
Alex Donesky
d359429f04
Stop GasFeeController polling when pop closes (#11746)
* Stop GasFeeController polling when pop closes

* Stop estimate gas polling on window unload

* lint + comments

* Improve client closed logic

* lint

* Add back _beforeUnload on unmount in gas-modal-page-container

* Add full check and call onClientClosed method for notifcation environment

* Add gas pollingToken tracking to appStateController and use to disconnect polling for each environment type

* remove unused method

* move controller manipulation logic from background.js to metamask-controller, disaggregate methods

* add beforeunload handling to reset gas polling tokens from root of send page

* cleanup, lint and address feedback

* clear appState gasPollingTokens when all instances of all env types are closed, fix pollingTokenType arg from onEnvironmentTypeClosed call in metamask-controller

* mock new methods to fix tests

* final bit of cleanup + comments

Co-authored-by: Dan Miller <danjm.com@gmail.com>
2021-08-04 16:53:13 -05:00
David Walsh
c8b3dfe4e9
EIP-1559 - Fall back to gasLimit and gasPrice for hardware wallets (#11716) 2021-08-02 17:52:18 -05:00
Dan J Miller
668fd2db66
Ensure that gas fee/prices params are not updated while in send edit stage/mode (#11620)
* Ensure that gas fee/prices params are not updated while in send edit stage/mode

* Allow editing of txparams gas price when not on eip1559 network, in send flow
2021-08-02 12:17:42 -02:30
Brad Decker
e0953d9f68
Update send and confirm state management, and tx controller gas defaults, for EIP1559 (#11549)
wip

Documentation improvements for send slice support of EIP1559

Remove console.log in send duck

Property lookup safety improvement in selectors/confirm-transaction

Add code accidentally removed in rebase

Update addTxGasDefaults and _getDefaultGasFees to work with new estimate types, and ensure we correctly handle gas price estimates when on EIP1559 networks (#11615)

* Fix typo

Remove console.log in send duck

* Update addTxGasDefaults and _getDefaultGasFees to work correctly with all new gas fee estimate types

* Don't show gas timing support when not on eip1559 compatible network

* Hide gas timing component on transaction screen when on a non-1559 network

* Improve comments, tests and edge case handling

* Ensure eip1559 fees are applied and updated correctly when eip1559 estimate api fails

* Lint fix

Co-authored-by: Brad Decker <git@braddecker.dev>

Remove console.log

Handle possible gasEstimateType undefined

Remove unnecessary nonce field position change in confirm-page-container-content__details
2021-07-30 22:15:18 -02:30
Daniel
714170c7b8
EIP-1559 and Rinkeby Testnet support in Swaps (#11635) 2021-07-30 13:35:30 +02:00
ryanml
d03dc311ee
Adding hex address guard to input validation for token sends (#11608) 2021-07-26 07:07:57 -07:00
Dan J Miller
02318df48c
Ensure that the send flow state recipient nickname gets set if recipient address is in addressBook (#11610) 2021-07-26 07:03:05 -07:00
Dan J Miller
2ac7b27876
Fix sending maximum of an ERC20 token (#11594)
* Fix sending maximum of an ERC20 token

* Always update gas limit when send amount updates
2021-07-23 17:40:40 -07:00
ryanml
8cb1557f1c
Adding method to capture one-time Sentry exceptions (#11553) 2021-07-22 16:13:40 -07:00
Dan J Miller
ac15b3b465
Ensure send slice gas loading state is set to false upon gas estimation error (#11581) 2021-07-21 16:00:00 -02:30
Brad Decker
dc25a24de3
rely upon gas fee controller for gas price estimates (#11511) 2021-07-16 11:06:32 -05:00
Dan J Miller
809b93dd77
Ensure simple send gas estimation happens after the recipient is iden… (#11485)
* Ensure simple send gas estimation happens after the recipient is identified

* Update ui/ducks/send/send.test.js

Co-authored-by: Alex Donesky <adonesky@gmail.com>

* Improve test name

* Lint fix

Co-authored-by: Alex Donesky <adonesky@gmail.com>
2021-07-09 15:39:43 -02:30
Daniel
d438439661
Swaps: Add conditional routing to new APIs based on a feature flag (#11470) 2021-07-09 10:24:00 -05:00
Alex Donesky
2cb807dc20
fix up ens/hex address validation error handling (#11477)
* fix up ens/hex address validation error handling

* fix lint/tests
2021-07-09 09:17:02 -05:00
Brad Decker
68dfc98f40
wire up gasFeeController (#11421) 2021-07-08 15:23:00 -05:00
Brad Decker
da9fb4636b
move conversion utils to shared folder (#11451) 2021-07-06 12:48:49 -05:00
Dan J Miller
bda4d0cbca
Add list of custom networks with special gas limit buffers (#11435) 2021-07-01 19:18:30 -02:30
Dan J Miller
a60301686c
Ensure that eth_estimateGas is called to estimate gas limit for simple sends on custom networks (#11418)
* Ensure that eth_estimateGas is called to estimate gas limit for simple sends on custom networks

* getIsNonStandardEthChain returns false when in test

* Add comment explaining gas limit buffer multipliers in estimateGasLimitForSend
2021-06-30 23:24:47 -02:30
Brad Decker
844a021fcd
remove ui lookup of lastGasPrice field (#11411) 2021-06-29 11:02:00 -05:00
Brad Decker
23a859826f
add method to detect EIP 1559 support (#11369) 2021-06-25 11:24:00 -05:00
ryanml
a69ed05141
Removing obsolete client-side transaction metrics events (#11329)
* Removing metametrics send count tracking

* Removing client side Transaction Completed and Canceled events
2021-06-24 15:37:44 -07:00
Alex Donesky
a6e16f458e
Adding edit navigation button flow back to send token flow (#11335) 2021-06-23 18:50:24 -05:00
Brad Decker
c30cb7d33a
Refactor send page state management (#10965) 2021-06-23 16:35:25 -05:00
Alex Donesky
27389fc71e
fix unsafe destructuring instance (#11351) 2021-06-21 09:28:35 -05:00
Alex Donesky
a8643af481
patch gas price issue - add fallback gas price (#11239) 2021-06-15 09:17:42 -05:00
Brad Decker
9e509d0c9d
Relocate send state into send duck from metamask duck (#11252) 2021-06-10 12:53:15 -05:00
Brad Decker
b073b04789
move metamask state selectors out of send (#11249) 2021-06-08 11:03:59 -05:00
Niranjana Binoy
2972e78444
Avoid showing "Gas price extremely low" warning in advanced tab for testnets (#11111) 2021-05-20 11:32:55 -04:00
Daniel
f9a52edb98
Fix a condition for checking if a token should be added (#11127) 2021-05-18 13:16:17 -05:00
Daniel
85eb62e8cf
Swaps: Add specific error content if Contract data are not enabled on Ledger (#11088) 2021-05-13 14:49:00 -05:00
Daniel
a174e3b99a
Swaps: Add more anonymized tracking for HW wallet and HW wallet type (#11087) 2021-05-13 14:26:08 -05:00
Daniel
a34f579484
Swaps: Add anonymized tracking for HW wallet and HW wallet type (#11063) 2021-05-12 10:17:17 -05:00
Mark Stacey
14dc6b58cc
Remove SET_CURRENT_FIAT action (#11003)
The `SET_CURRENT_FIAT` action has been removed. It has been replaced
by a call to `forceUpdateMetamaskState`. The only purpose of this
action was to eagerly update the current fiat currency settings before
the next state update. Forcing a state update instead is simpler and
safer.

The `setCurrentCurrency` function in the background has been updated to
no longer return the state, now that it's no longer needed.
2021-05-07 11:32:22 -02:30
Daniel
002763222b
Swaps: Improve hardware wallet UX (#10987) 2021-05-06 09:14:42 -05:00
Brad Decker
09d81ac5f2
remove the ui/app and ui/lib folders (#10911) 2021-04-28 14:53:59 -05:00