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

4920 Commits

Author SHA1 Message Date
Zachary Belford
6f6984fa58
Moved subscribe and filter into network controller (#16693)
Our middleware for handling subscription and filter-related methods (`eth-json-rpc-filters`) currently lives in our RPC pipeline ahead of the network stack. This commit moves this middleware to the network client middleware instead. There are two reasons for this change. First, this middleware wraps RPC methods that are supported by the network. Second, it is necessary for this middleware to live with the network client so that it will aid us in unifying the NetworkController in this repo and the NetworkController in the `controllers` repo.

Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
2022-12-20 10:28:09 -07:00
Jyoti Puri
c61d44a3be
Making add un-approved transaction idempotent (#16995) 2022-12-20 18:01:37 +05:30
Guillaume Roux
85f260c22d
[FLASK] Use custom UI for dialogs (#16973)
* update dialog templates to use custom UI

* add TODO comments

* Fix showDialog hook and destructuring

* Regen LavaMoat policies

* Re-add legacy snap confirmation for now

* Fix circular dependency issue

* Revert change to token-util

* Fix lint

Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
2022-12-20 11:44:22 +01:00
Frederik Bolding
abe0204171
[FLASK] snaps-monorepo@0.27.1 (#16981)
* snaps-monorepo@0.27.0

* Regen LavaMoat policies

* Remove unused constructor arg

* snaps-monorepo@0.27.1
2022-12-20 11:44:05 +01:00
Olusegun Akintayo
13de51e748
Security and Privacy Settings Re-org (#16756) 2022-12-19 18:46:36 +01:00
Mark Stacey
3e98758719
Rename the network controller module (#16974)
The network controller module has been renamed from `network.js` to
`network-controller.js`. All of our newer controllers have "controller"
in the module names, so this aligns better with that convention. It
also brings the test module name into alignment (it's already called
"network-controller.test.js").
2022-12-16 16:37:06 -03:30
Mark Stacey
dbe77289d3
Make initializeProvider and lookupNetwork async (#16881)
* Make `initializeProvider` and `lookupNetwork` async

These two methods were "synchronous" previously, but initiated an
asynchronous operation. They have both been made `async` to bring them
more in-line with the mobile controller API, and to make them easier
to test.

This should include zero functional changes. These methods are still
being invoked without an `await`, to preserve the same behaviour they
had previously.

This relates to https://github.com/MetaMask/controllers/issues/971

* Move 'net_version' query to private function

* Fix error made when resolving conflicts

* Refactor to improve readability
2022-12-16 13:03:22 -03:30
Dan J Miller
ba3914e9fe
Sanitize privacy sensitive data before sending to sentry. (#16780)
* Sanitize privacy sensitive data before sending to sentry.

Temp

Near complete

Complete

* Temp

* Fix url error message rewrite

* Add unit tests and cleanup code

* Improvements

* Update app/scripts/lib/setupSentry.js

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

* Update app/scripts/lib/setupSentry.js

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

* Update app/scripts/lib/setupSentry.js

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

* Fix syntax of doc comments

* Catch errors caused by invalid urls in sanitizeUrlsFromErrorMessages

* Ensure our allowlist matches multiple subdomains

* Ensure sanitizeUrlsFromErrorMessages correctly matches hostnames

* Update app/scripts/lib/setupSentry.js

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

* Improve test descriptions

* fix

Co-authored-by: Ariella Vu <20778143+digiwand@users.noreply.github.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2022-12-16 11:56:23 -03:30
Frederik Bolding
0511d6f0b1
[FLASK] Bump snaps iframe-execution-environment (#16932) 2022-12-14 11:48:50 +01:00
Alex Donesky
5d285f7be5
fix cached detected token results (#16866) 2022-12-14 12:26:08 +05:30
Brad Decker
e83111cc7e
Nock some endpoints to improve test perf (#16940) 2022-12-13 14:20:24 -06:00
Elliot Winkler
dd59792392
Remove if to expose more network client tests (#16906)
This commit affects the network client tests, which were added in a
previous PR to test the behavior of `createInfuraClient`, a function
called that sets up a portion of the middleware stack in the JSON-RPC
layer.

An `if` statement appears in the tests which limits the execution of
certain tests. However, this seems to have been added for debugging
purposes and is not actually needed.

Co-authored-by: Brad Decker <bhdecker84@gmail.com>
2022-12-13 12:49:58 -07:00
Mark Stacey
69e5d6da4a
Make certain network controller methods private (#16883)
Five network controller methods have been renamed to start with an
underscore:
* `getLatestBlock`
* `setNetworkState`
* `setNetworkEIPSupport`
* `clearNetworkDetails`
* `setProviderConfig`

All of these methods were used solely within the network controller.
The leading underscore now documents these methods as being private.

A few tests required updates as well because they were stubbing out one
of these methods.

This should include zero functional changes.

This relates to https://github.com/MetaMask/controllers/issues/971
2022-12-13 15:43:54 -03:30
Mark Stacey
06d87fb98b
Refactor how network state is passed to transaction controller (#16922)
The network state is now passed to the TransactionController via a
getter function and a subscription function, instead of passing one of
the network controller stores directly.

This way of passing the state makes further refactoring easier, as we
don't have to change the input when the store is changed or replaced.
It's also more aligned with our conventions today.

This change was made as part of a larger refactor of the network
controller, as part of the effort to merge the mobile and extension
network controllers.
2022-12-13 15:43:12 -03:30
Ariella Vu
be6edb4bc8
scripts/ui: add tabs.query promise error handler (#16915) 2022-12-14 01:21:32 +07:00
Mark Stacey
75177c5998
Make setProviderType synchronous (#16879)
The network controller method `setProviderType` was marked as `async`
despite doing nothing async internally. The `async` has been dropped.

This should have zero functional impact.

This relates to https://github.com/MetaMask/controllers/issues/971
2022-12-13 13:57:48 -03:30
Mark Stacey
5df6f653af
Remove unused verifyNetwork method (#16882)
The network controller method `verifyNetwork` has been deleted. It was
unused.

This relates to https://github.com/MetaMask/controllers/issues/971
2022-12-13 13:57:28 -03:30
Ariella Vu
e4e69d86b2
onboardingV2: fix privacy policy in spanish (#16918) 2022-12-14 00:16:10 +07:00
Mark Stacey
6d64951938
Move infuraProjectId to network controller constructor (#16884)
The network controller `setInfuraProjectId` method has been deleted.
The Infura project ID is only ever set upon construction, so it is now
passed in as a constructor parameter instead.

Rather than adding this as a second parameter, the network controller
now uses an "options bag" for constructor parameters. The initial state
was the first parameter, but it's now passed in as the `state` option
instead.

These changes make the API more similar to the mobile network
controller API.

This should have zero functional changes.

This relates to https://github.com/MetaMask/controllers/issues/971

Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
2022-12-13 12:09:21 -03:30
Mark Stacey
048b7e4cb6
Fix shared mocks in RPC network client test (#16856)
* Fix shared mocks in RPC network client test

Some of the provider api unit tests were inadvertently sharing test
mocks. A `params` object used for mock RPC calls was being shared
between tests and between calls within individual tests. They have been
updated to generate a fresh `params` object for each mock RPC call.

* Explicitly set blockParam to undefined
2022-12-12 13:49:22 -03:30
Ariella Vu
4d4e487ffc
Handle extension unloaded and reloaded error: "Extension context invalidated" during dapp use for chromium browsers (#16306)
* dapp: handle ext unloaded or reloaded error

* dapp: handle ext unloaded or reloaded error pt. 2
- use const
- mention case is unsupported in Firefox

Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
2022-12-12 19:24:12 +07:00
Frederik Bolding
c75d2dce55
[FLASK] Implement Snaps UI Renderer (#16605)
* Start implementation of Snaps UI Renderer

* Add snap name and fix some design issues

* Fix lint

* Add some types

* More fixes

* Actually install snaps-ui

* Use JS instead of TS

* Remove unused deps

* Remove dep

* Update LavaMoat policies

* Fix style lint

* Add story

* Small tweaks after rebase

* Remove spacer and add test

* Fix lint

* Remove console.log

* Add error message

* Remove edge-case that doesnt exist anymore

* Update yarn.lock

* Update policy
2022-12-09 13:05:31 +01:00
Jyoti Puri
8125473dc5
Removing flag for EIP1559 V2 support (#16446) 2022-12-09 00:07:06 +05:30
David Walsh
7d3b1d08da
NFTs: Update COLLECTIBLES_V1 to NFTS_V1 (#16851) 2022-12-08 11:37:47 -06:00
David Walsh
43c278d813
Privacy - Show default selected network after a custom network has been added during onboarding (#16789)
* Privacy - Allow users to set a custom RPC from the onboarding process (#16767)

* Privacy - Allow adding custom IPFS from onboarding (#16782)

* Privacy - Show default selected network after a custom network has been added during onboarding

* WIP: Show dropdown list of networks

* Add network switcher to the onboarding advanced privacy screen

* Fix duplicate imports

* Provide default for networks

* Update ui/helpers/utils/ipfs.js

Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>

* Fix lint

* Remove unwanted changes

* Fix lint

Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
2022-12-08 10:42:23 -06:00
Pedro Figueiredo
3a456a45fc
fix locales for advance config (#16849) 2022-12-08 14:20:59 +00:00
ryanml
a759d427f0
Remove new address alert (#14811)
* Removing new address alert

* remove unused copy

* fix broken e2e test

* rework layout nesting

* satisfy lint

* change layout to fix firefox tests

* change selector specificity on e2e test

* revert test change after fix has been merged from develop

* fix linting

Co-authored-by: Brad Decker <bhdecker84@gmail.com>
Co-authored-by: Pedro Figueiredo <pedro.figueiredo@consensys.net>
2022-12-08 14:20:24 +00:00
Adnan Sahovic
34b1595f29
Add Celo to the popular custom network list (#16745) 2022-12-07 14:13:37 -06:00
David Walsh
ead5076b86
Privacy - Update metametrics copy during onboarding (#16825) 2022-12-07 12:56:57 -06:00
amerkadicE
8885c54f13
NFT setApprovalForAll warning popover (#16195)
* NFT setApprovalForAll  warning popover
2022-12-06 14:24:07 -06:00
Vladimir Saric
9ede85c9ac
Updated secondary copy and removed the address component from SetApprovalForAll and NFT Approve screens (#16292) 2022-12-05 10:59:15 -06:00
Brad Decker
f7014a79fc
remove network name from analytics (#16781) 2022-12-03 09:57:48 -06:00
Alex Donesky
f162c58f5a
Allow adding networks with the same chainId as a preloaded/default network via wallet_AddEthereumChain API (#16733)
* allow adding networks with the same chainId as an existing network via API

Co-authored-by: Kurush Dubash <kurush@alchemyapi.io>
2022-12-02 21:14:27 -06:00
Alex Donesky
05ab94fd1c
Add security & privacy "What's New" message (#16783) 2022-12-02 17:59:41 -06:00
Jyoti Puri
154172d5f8
Network request in background should not start until onboarding is completed (#16773) 2022-12-02 23:29:03 +05:30
Jyoti Puri
a5e70cbd71
Adding middleware to filter out duplicate requests from DAPP (#16730) 2022-12-02 21:08:12 +05:30
amerkadicE
702cab5fa7
Add user guidance on signature request screen (#16600) 2022-12-02 08:12:43 -06:00
Pedro Figueiredo
d096560d85
Give the user ability to opt out of get balance batch request for all loaded accounts (#16746) 2022-12-01 21:16:04 +00:00
Erik Marks
a861cc6dae
[FLASK] Add snap alerts and prompts via snap_dialog RPC method (#16048)
Co-authored-by: Guillaume Roux <guillaumeroux123@gmail.com>
Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
2022-12-01 16:46:06 +01:00
Dan J Miller
91e275e0d1
Use NETWORK_EVENTS.NETWORK_DID_CHANGE to trigger network change callback in assetsContractController (#16760) 2022-12-01 11:03:38 -03:30
Frederik Bolding
025ee2cb48
[FLASK] Expose transaction origin to transaction insight snaps (#16671)
* Expose transaction origin to transaction insight snaps

* Support multiple icons for each label for a permission

* Add transaction insight origin permission

* Fix fencing

* Fix import and permission crash

* Use function properly for connected accounts
2022-12-01 14:38:56 +01:00
Brad Decker
b3895b6840
remove rpc urls from metrics (#16710) 2022-11-30 09:52:25 -06:00
amerkadicE
dd0844e200
Add signature request warning modal (#16225)
* Add signature request warning modal

Fix e2e tests

Fix e2e tests

Remove warning message from eth sign request

Remove unused locales

Fix e2e test

Fix e2e test

* Run pipeline

* Fix locales:
?

* Add unit tests
2022-11-30 16:34:50 +01:00
Frederik Bolding
dfb6210910
[FLASK] snaps-monorepo@0.25.0 (#16673)
* snaps-monorepo@0.25.0

* Regen LavaMoat policies

* Bump test-snaps

* [FLASK] Add Snaps JSON-RPC handler permission (#16670)

* Add Snaps JSON-RPC handler permission

* Add copy and icon

* Fix test

Co-authored-by: Maarten Zuidhoorn <maarten@zuidhoorn.com>
2022-11-30 13:19:33 +01:00
amerkadicE
505517e8c7
Fix: multiple reject on the signature request screen (#16199)
Co-authored-by: Brad Decker <bhdecker84@gmail.com>
2022-11-30 08:13:14 +01:00
Jyoti Puri
ba25ad4073
Not use hardware keyring classes when initializing KeyringController in extension MV3 version (#16684) 2022-11-29 22:34:11 +05:30
Jyoti Puri
ea882d4588
DAPP action replay improvements (#16250) 2022-11-29 22:33:13 +05:30
Brad Decker
6c6b4aca1e
fix issue preventing switching to localhost (#16707) 2022-11-29 10:01:23 -06:00
dragana8
2680340e27
Unable to proceed with tx bc of inaccurate/overly aggressive "Insufficient funds for gas" warning #13087 (#14634)
Co-authored-by: VSaric <vladimir.saric@consensys.net>
2022-11-28 10:41:42 -06:00
Adnan Sahovic
6f21c4837d
Token allowance i18n interpolation system (#16347)
* added i18n interpolation system to token-allowance screen

* modified revokeSpendingCap

* Fixed minor type error

* resolved conflicts
2022-11-25 06:56:29 -03:30