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

3377 Commits

Author SHA1 Message Date
Guillaume Roux
c9dc59ea2a
[FLASK] Snaps Insight (#15814)
Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
Co-authored-by: Hassan Malik <41640681+hmalik88@users.noreply.github.com>
2022-09-20 19:00:07 +02:00
Nicolas Ferro
1b563188bf
Ability to buy tokens with Coinbase Pay and Transak (#15551)
Co-authored-by: Ariella Vu <20778143+digiwand@users.noreply.github.com>
Co-authored-by: Brad Decker <git@braddecker.dev>
Co-authored-by: Brad Decker <bhdecker84@gmail.com>
2022-09-19 10:00:57 -05:00
Dan J Miller
075a6fb86a
Properly configure ethereumjs Common for Sepolia network (#15871) 2022-09-19 08:17:40 -05:00
Filip Sekulic
6e13524bcd
Remove related UI code from the app dir (#15384)
Co-authored-by: metamaskbot <metamaskbot@users.noreply.github.com>
Co-authored-by: Brad Decker <bhdecker84@gmail.com>
Co-authored-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2022-09-16 14:05:21 -05:00
Jyoti Puri
c2b7690119
Make metrics related actions idempotent (#15737) 2022-09-16 22:34:14 +05:30
Mark Stacey
f465089c2a
Make environment variables higher precedence than config (#15858)
Environment variables are now considered as higher-precedence than
configuration by our build system. This means that if the same value is
set in `.metamaskrc` and in an environment variable, the environment
variable is what will be used. Previously the reverse was true, the
configuration would take precedence.

It is conventional for CLI tools to consider environment variables as
higher precedence than configuration. This makes our build system less
surprising for most people.
2022-09-16 14:28:43 -02:30
Elliot Winkler
d91eabfd16
Add initial provider API tests for Infura client (#15556)
We are working on migrating the extension to a unified network
controller, but before we do so we want to extract some of the existing
pieces, specifically `createInfuraClient` and `createJsonRpcClient`,
which provide the majority of the behavior exhibited within the provider
API that the existing NetworkController exposes. This necessitates that
we understand and test that behavior as a whole.

With that in mind, this commit starts with the Infura-specific network
client and adds some initial functional tests for `createInfuraClient`,
specifically covering three pieces of middleware provided by
`eth-json-rpc-middleware`: `createNetworkAndChainIdMiddleware`,
`createBlockCacheMiddleware`, and `createBlockRefMiddleware`.

These tests exercise logic that originate from multiple different places
and combine in sometimes surprising ways, and as a result, understanding
the nature of the tests can be tricky. I've tried to explain the logic
(both of the implementation and the tests) via comments. Additionally,
debugging why a certain test is failing is not the most fun thing in the
world, so to aid with this, I've added some logging to the underlying
packages used when a request passes through the middleware stack.
Because some middleware change the request being made, or make new
requests altogether, this greatly helps to peel back the curtain, as
failures from Nock do not supply much meaningful information on their
own. This logging is disabled by default, but can be activated by
setting `DEBUG=metamask:*,eth-query DEBUG_COLORS=1` alongside the `jest`
command.

We use this logging by bumping `eth-block-tracker`, and
`eth-json-rpc-middleware`.
2022-09-16 10:48:33 -02:30
Mark Stacey
929a1a0d52
Update eth-json-rpc-infura (#15845)
* Update `eth-json-rpc-infura`

The package `eth-json-rpc-infura@5` has been updated to
`@metamask/eth-json-rpc-infura@7`. This update includes TypeScript
support, and it drops support for older node.js versions. The exports
have also been changed from default to named exports.

See here for a full list of changes: https://github.com/MetaMask/eth-json-rpc-infura/blob/main/CHANGELOG.md#700

* Fix LavaMoat policy issue

The `web3` package used by `@metamask/controllers` unintentionally
overwrites the `XMLHttpRequest` global, which breaks things. This was
fixed by revoking `web3`'s write access to that global using a policy
override.

Previously this policy override was applied to `web3`, but for some
unknown reason, this update caused that override to no longer apply.
2022-09-15 14:41:18 -02:30
Niranjana Binoy
32aa47ddb2
Displaying the aggregators from tokenList in Detected token popover (#15835)
* using the aggregators from tokenList instead of detectedToken to avoid conflicts between static and dynamic list

* removing aggregator from the detectTokens object List
2022-09-15 12:53:18 -02:30
ryanml
7b04bf8b47
Adding Sepolia as a default test network (#15787) 2022-09-14 13:26:45 -05:00
Brad Decker
c87980bbfe
migrate network constants to typescript (#15610) 2022-09-14 09:55:31 -05:00
Ariella Vu
d3c7b9fb32
MV3: contentscript.js - re-activate streams when Service Worker terminates and then resets (#15494)
* contentscript: reactivate streams pt.1

* contentscript: reactivate streams pt. 2

* scripts/inpage.js: use const

* clean: rm unused @param

* contentscript: reactivate streams pt. 3
- reorganize functions

* resetSteamAndListeners -> resetStreamAndListeners

* contentscript: skip Legacy Provider while WIP

* contentscript: rm comment sentence

* initPageStreams -> initStreams

* setupPageStreams -> setupStreams

* contentscript: only destroy extension streams WIP

* remove pageMuxChannel listeners (It works!)
- credits to @gudhatt for this missing piece

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

* contentscript: cleanup

* contentscript: support legacy streams
w/ service workers

* contentscript: support phishing streams
w/ service workers

* contentscript: muxChannel -> channel

* contentscript: phishingExension -> phishingExt

* contentscript: add section comments

* contentscript: revert condensing comment

* contentscript: pagePhishing -> phishingPage

* contentscript: update comments

* contentscript: fix phishingExtPort

* contentscript: stream -> streams

* contentscript: update SW keep alive logic
should only keep alive when dapp is open / contentscript page

* rm console.log

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Jyoti Puri <jyotipuri@gmail.com>
2022-09-13 14:20:08 -07:00
Matthew Epps
dcfe80c255
Add entry point for metalabs dapp into metamask home page (#15407)
Co-authored-by: Dan Miller <danjm.com@gmail.com>
2022-09-13 08:41:58 -05:00
Jyoti Puri
0b1744d4eb
Make createSpeedUpTransaction action idempotent (#15688) 2022-09-13 18:13:38 +05:30
amerkadicE
7aa2a8a983
Replace web3js package with ethersjs package (#15386)
Co-authored-by: Alex Donesky <adonesky@gmail.com>
2022-09-12 15:46:48 -05:00
Jyoti Puri
216f76646e
Make cancel transaction idempotent (#15675) 2022-09-09 17:20:31 +05:30
Jyoti Puri
8c8539d1f5
Making addPermittedAccount and removePermittedAccount methods idempotent (#15709) 2022-09-07 01:17:48 +05:30
VSaric
cd5398b2b2
Replaced use of pubnub for uuid method in app/ directory (#15712) 2022-09-06 09:13:04 -05:00
Jyoti Puri
3154e5e19c
Make updateTransactionSendFlowHistory background method idempotent (#15585) 2022-09-06 14:39:12 +05:30
Jyoti Puri
3fb7de5768
Make addUnapprovedTransaction action idempotent (#15667) 2022-09-06 14:38:32 +05:30
Jyoti Puri
99ed42b3dc
MV3: add retry logic to actions (#15337) 2022-09-05 20:25:34 +05:30
Frederik Bolding
7fc418a96d
[FLASK] snaps-skunkworks@0.20.0 (#15706)
* snaps-skunkworks@0.20.0

* Generate LavaMoat policy

* Fix some breaking changes

* Update iframe execution env

* Fix unit tests

* Implement snap_getBip44Entropy

* Regenerate LavaMoat policy

* Prefer ControllerMessenger over direct calls

* Fix not showing warning for BIP44 legacy permission and E2E test

Co-authored-by: Maarten Zuidhoorn <maarten@zuidhoorn.com>
2022-08-26 13:48:53 +02:00
PeterYinusa
fe78890dd2
Sentry e2e test (#15715) 2022-08-25 18:07:31 -05:00
Mark Stacey
35dbdbc438
Replace lavamoat-runtime.js patch (#15682)
A patch made in #15672 was found to be unnecessary. Instead of setting
a `rootGlobals` object upon construction of the root compartment, we
are now creating a `sentryHooks` object in the initial top-level
compartment. I hadn't realized at the time that the root compartment
would inherit all properties of the initial compartment `globalThis`.

This accomplishes the same goals as #15672 except without needing a
patch.
2022-08-24 09:50:45 -02:30
Mark Stacey
1f36ba4b75
Fix Sentry deduplication of events that were never sent (#15677)
The Sentry `Dedupe` integration has been filtering out our events, even
when they were never sent due to our `beforeSend` handler. It was
wrongly identifying them as duplicates because it has no knowledge of
`beforeSend` or whether they were actually sent or not.

To resolve this, the filtering we were doing in `beforeSend` has been
moved to a Sentry integration. This integration is installed ahead of
the `Dedupe` integration, so `Dedupe` should never find out about any
events that we filter out, and thus will never consider them as sent
when they were not.
2022-08-23 16:14:14 -02:30
Filip Sekulic
365bf11fdd
New network info popup (#13319) 2022-08-23 10:04:07 -05:00
Mark Stacey
d55507615c
Fix Sentry in LavaMoat contexts (#15672)
Our Sentry setup relies upon application state, but it wasn't able to
access it in LavaMoat builds because it's running in a separate
Compartment.

A patch has been introduced to the LavaMoat runtime to allow the root
Compartment to mutate the `rootGlobals` object, which is accessible
from outside the compartment as well. This lets us expose application
state to our Sentry integration.
2022-08-23 11:12:50 -02:30
Jyoti Puri
637d4bcf2c
Adding unit test case to for idempotent behaviour of importAccountWithStrategy idempotent (#15583) 2022-08-19 08:43:08 -05:00
Jyoti Puri
29e252e162
Add unit test coverage to ensure that addToken method is idempotent. (#15587) 2022-08-19 18:00:40 +05:30
John Brennan
1c9764a6a2
Fix onboarding events (#15608) 2022-08-18 16:31:07 -05:00
Jyoti Puri
f15d8e2f9b
Add test case to ensure that action addCustomNetwork is idempotent (#15602) 2022-08-19 01:09:04 +05:30
Alex Donesky
94180e850e
filter breadcrumbs for improved clarity while debugging sentry errors (#15639) 2022-08-18 13:38:59 -05:00
Dan J Miller
fc232da4c4
Fix state creation in setupSentryGetStateGlobal (#15635) 2022-08-18 15:25:28 -02:30
Maarten Zuidhoorn
a52c6a4908
[FLASK] snaps-skunkworks@0.19.0 (#15619)
* Bump snaps-skunkworks to 0.19.0

* Improve snap_getBip32Entropy UI

* Remove console.log

* Update LavaMoat policy

* Dedupe Yarn lock

* Update LavaMoat policy again

* Fix tests

* Update policies and e2e tests

* Update policy again

* Update iframe-execution-environment

* Dedupe yarn.lock

* Update snapshots

* Fix PR comments

* Add TODO

* Trigger CI
2022-08-18 17:07:34 +02:00
VSaric
6e0f130168
New metrics data for token approval transactions (#15289) 2022-08-18 08:49:50 -05:00
Jyoti Puri
eb85fc266d
Refactoring isManifestV3 variable (#15568) 2022-08-16 20:51:42 +05:30
Jyoti Puri
1a8d0c91f0
Fix rpc and tests (#15570) 2022-08-16 18:21:35 +05:30
Jyoti Puri
d2fc5ecc3e
Make add new account idempotent operation (#15566) 2022-08-16 11:42:00 +05:30
Dan J Miller
6855b06e13
Prevent type error in catch block in account-tracker.js _updateAccount (#15589) 2022-08-15 15:28:56 -02:30
David Walsh
9cf358a82a
Fix #14846 - Inject provider for MV3 via app-init (#15448) 2022-08-15 11:26:13 -05:00
Daniel
2eb0fe6978
Add more tracking for MetaMask (#15462) 2022-08-11 19:33:33 +02:00
Niranjana Binoy
6e5c2f03bf
Token detection V2 Flag Removal and Re-introducing the use of legacy token list when token detection is OFF (#15138)
* addding the legacy tokenlist, tuning token detection OFF by default, adding new message while importing tokens

updating the controller version and calling detectNewToken on network change

fixing rebase error

Run yarn lavamoat:auto for updating policies

updating lavamoat

Deleted node modules and run again lavamoat auto

fixing rebase issues

updating lavamoat policies

updating lavamoat after rebasing

policies

updating custom token warning and blocking detectedtoken link when tpken detection is off for supported networks

to update the token in fetchTosync

updating the contract map object

Revert build-system lavamoat policy changes

Move token list selection logic from components to getTokenList selector

updating the tokenList

Update lavamoat

Fix error

updating lavamoat

lint fix

fix unit test fail

fix unit test fail

lint fix

fixing rebase locale error

rebase fix

Revert build-system policy changes

temp

addressing review comments

* rebase fix
2022-08-09 22:56:25 -02:30
Olusegun Akintayo
4f34e72085
3box Replacement (#15243)
* Backup user data

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

Tests for prependZero (utils.js)

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

Fix advancedtab test

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

backup controller tests

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

Lint fixes

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

Backup controller don't have a store.

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

Restore from file.

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

Advanced Tab tests

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

Lint fix

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

e2e tests for backup
unit tests for restore.

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

Fix comments on PR.

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

restore style

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

Lint fixes

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

We should move the exportAsFile to a utility file in the shared/ directory

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

Move export as file to shared folder

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

Refactor create download folder methods

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

Lint fixes.

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

Move the backup/restore buttons closer to 3box

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

Change descriptions
Add to search

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

refactor code to use if instead of &&

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

Lint fixes

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

Restore button should change cursor to pointer.

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

Fix restore not uploading same file twice.

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

Do not backup these items in preferences
    identities
    lostIdentities
    selectedAddress

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

lint fixes.

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

* Only update what is needed.

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

* Fixed test for search

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

* remove txError as it currently does nothing.

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

* Remove dispatch, not needed since we're not dispatching any actions.

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

* Event should be title case.

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

* Make backup/restore normal async functions
rename event as per product suggestion.

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

* Use success Actionable message for success message and danger for error
message

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

* change event name to match with backup

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

* Lint fixes

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

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

* fix e2e

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2022-08-09 19:36:32 +01:00
Daniel
d255fcdefb
Only check if a user has enough token balance before calling STX (#15218) 2022-08-09 12:56:52 -05:00
kumavis
6104b842d2
Update createMethodMiddleware.js (#15505) 2022-08-08 16:52:40 -10:00
Mark Stacey
42c8703f3e
Add comments about legacy streams (#15492)
Two comments have been added to reference a longer explanation of what
the legacy provider streams are, why we still have them, and why we
want to remove them.
2022-08-05 16:52:07 -02:30
Erik Marks
0075237ade
Stop injecting provider on docs.google.com (#15459) 2022-08-05 09:38:51 -05:00
Dan J Miller
6602e4a013
Ensure smart contract interactions are properly represented on the confirm screen (#15446)
* Ensure smart contract interactions are properly represented on the confirm screen

* Fix unit tests

* Code cleanup

* Cleanup

* Code cleanup

* Fix test
2022-08-03 17:05:34 -02:30
Hassan Malik
a7179a6b88
[FLASK] Add update snap UI (#15143)
* added snap-update folder

* addded update route, snap update component, updated permissions connect components

* added actions and selectors

* updated permissions selectors and updated permissions connect container to have update snap logic

* updated translations, added selector, updated request object

* updated translations, added update snap permission list component

* more fixes

* added CSS, redid some HTML

* lint fixes

* Add missing grantPermissions action

* updated button padding

* fixes

* removed prop type

* fix Update & Install wrapping

* made changes for forthcoming snap controller PR

* removed ununsed imports

* updated css

* re-added padding rule and removed unused translation messages

* addressed comments

* add subtext for new permissions

* lint fix

* removed unused translations

* some more changes

* fix e2e tests

* lint fix

* added in delay for e2e tests

* Revert "added in delay for e2e tests"

This reverts commit 095962a2c0c9de0b0b343d3134bb0787044dd8ce.

* fixed routing logic

Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
Co-authored-by: Guillaume Roux <guillaumeroux123@gmail.com>
2022-08-03 12:02:44 -04:00
Mark Stacey
3b30984ce5
Fix "app-init" injection (#15320)
* Fix "app-init" injection

The way we were injecting variables into the `app-init.js` bundle was
accidentally overwriting the bundle output with the raw `app-init.js`
source file. This is a problem because the bundling process handles a
lot of things we care about like source maps, polyfills and other
necessary Babel transformations, environment variable injection, and
minification.

Instead of using string replacement to inject variables, we are now
using environment variables. The old string replacement strategy has
been removed, and the `app-init.js` module is now generated using the
same process as our other bundles.

A new option, "extraEnvironmentVariables", was added to allow us to
inject environment variables specifically for this bundle.

* Add check to ensure APPLY_LAVAMOAT is set
2022-08-03 12:51:10 -02:30
Sam Gbafa
5802805597
Add Sign-In with Ethereum (#14438)
Co-authored-by: Gregório Granado Magalhães <greg.magalhaes@gmail.com>
Co-authored-by: George Marshall <georgewrmarshall@gmail.com>
Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
Co-authored-by: Ariella Vu <20778143+digiwand@users.noreply.github.com>
Co-authored-by: brad-decker <bhdecker84@gmail.com>
2022-08-03 09:56:11 -05:00
Dan J Miller
7e01dbca96
Stop throwing an error when adding gas defaults for a simple send, that has data, to an address without a response code (#15424)
* Stop throwing an error when adding gas defaults for a simple send, that has data, to an address without a response code

* Lint fix

* fixup lint

Co-authored-by: brad-decker <bhdecker84@gmail.com>
2022-08-02 22:14:21 -02:30
VSaric
ce901f8edb
Add data about dropped transaction in FINALIZED metrics event (#15383) 2022-08-02 10:53:09 -05:00
Jyoti Puri
bca9a61d6b
MV3: Re-activate service worker and reconnect UI streams (#14781) 2022-08-01 18:53:21 +05:30
Brad Decker
c72199a1a6
update prettier (#15360) 2022-07-31 13:26:40 -05:00
Adnan Sahovic
6723608173
Added speed up metrics data for transaction events and properly track speed up type (#15197) 2022-07-28 08:46:20 -05:00
Dan J Miller
aea5c5824f
Clean up of code introduced with 43f7a44 (#15158) 2022-07-27 15:19:05 -05:00
Frederik Bolding
8a550ce003
[FLASK] Fix missing snap hook (#15354) 2022-07-27 16:49:57 +02:00
Brad Decker
652d631cda
remove exclusions for mismatched object jsdoc type casing (#15351) 2022-07-27 08:28:05 -05:00
Brad Decker
1db0ee87ec
Update Eslint and deps (#15293) 2022-07-26 13:10:51 -05:00
Alex Donesky
b82d357a0d
Remove decentralized 4byte function signature registry since it contains incorrect signatures and we can't algorithmically check for best option when 4byte.directory is down (#15300)
* remove decentralized 4byte function signature registry since it is griefed and we can't algorithmically check for best option when 4byte is down

* add migration

* remove nock of on chain registry call in getMethodDataAsync test
2022-07-26 12:01:14 -05:00
Brad Decker
6246f02932
reducing logic gates in tx metrics (#15329) 2022-07-25 11:26:02 -05:00
Alex Donesky
8536c86ed5
Improve tokenId parsing and clean up useAssetDetails hook (#15304) 2022-07-23 09:37:31 -05:00
Dan J Miller
101fe0b27a
Metrics adjustments (#15313)
* Don't send errors to sentry if users have not opted-in to participate in metametrics

* Don't capture opt-out metrics

* Move the metrics-opt in screen to immediately after the welcome screen

* Ensure that global.getSentryState is set in the background

* Fix e2e tests after rearranging onboardin flow

* Fix unit tests

* More e2e test fixes

* Remove unnecessary wrappers around capture exception
2022-07-22 18:09:48 -02:30
VSaric
f1ca3e56e7
Modify transaction type and add contract method data to metrics (#15175) 2022-07-22 12:45:04 -05:00
Hassan Malik
e280204287
[FLASK] Add snap update metrics (#15206)
* added snap update metrics

* fixed update event
2022-07-22 10:08:43 -04:00
Dan J Miller
a0c9738924
Ensure that editing a tx from a transfer to a simple send resets data and updates type (#15248)
* Ensure that editing a transaction from a transfer to a simple send properly resets data and updates type

* Handle case where there are no unapproved txes

* Improve comment in updateSendAsset

* Remove unnecessary code in send transaction edit function

* Fix

* Ensure hex data is properly reset when changing from a safe transfer from tx to native send
2022-07-20 20:33:23 -02:30
Brad Decker
df646a03eb
Fix Provider Tracking Metrics (#15082) 2022-07-20 08:25:04 -05:00
Jyoti Puri
0622883a3c
Capturing load time stats (#15157) 2022-07-20 11:40:31 +04:00
David Walsh
c66c8aba63
Remove usage of querystring from contentscript (#15112) 2022-07-19 13:40:54 -05:00
David Walsh
95adbc245c
Set default getFetchWithTimeout default timeout value (#14218) 2022-07-19 11:13:45 -05:00
Filip Sekulic
7d321c48e0
Removed ui related code from shared directory (#15252) 2022-07-19 11:07:13 -05:00
Frederik Bolding
1ec190bd8c
[FLASK] snaps-skunkworks@0.18.1 (#15230)
* snaps-skunkworks@0.17.0

* Handle breaking changes

* Fix import

* Fix blocklist implementation

* snaps-skunkworks@0.18.0

* Fix lint

* Update LavaMoat policy

* Update iframe-execution-environment

* snaps-skunkworks@0.18.1

* Bump iframe-execution-environment

* Update LavaMoat policy
2022-07-19 17:41:06 +02:00
Alex Donesky
d92936475a
Fix default currency symbol for wallet_addEthereumChain + improve warnings for data that doesn't match our validation expectations (#15201)
* set more appropriate default for ticker symbol when wallet_addEthereumChain is called

* throw error to dapp when site suggests network with same chainId but different ticker symbol from already added network, instead of showing error and disabled notification to user
2022-07-18 10:59:38 -05:00
Ayanami
6cd036e9a1
Add goerli, bsc, optimism, polygon, avalance, fantom, arbitrum network to query balances using BalanceChecker (#13846) 2022-07-18 10:51:18 -05:00
Filip Sekulic
769b16eaa9
Fix the Sentry error for eth_getBalance (#14953)
Co-authored-by: David Walsh <davidwalsh83@gmail.com>
Co-authored-by: Brad Decker <bhdecker84@gmail.com>
2022-07-18 10:50:52 -05:00
Alex Donesky
09164dcabb
Bump controllers v30.0.2 (#14906)
* bump @metamask/controllers to v30.0.2 and adapt
2022-07-18 09:43:30 -05:00
Alex Donesky
4993d28a8f
Only send the rpc origin to segment when calling trackevent for newly added custom networks (#15227) 2022-07-15 12:08:44 -05:00
Filip Sekulic
7246058797
Added metrics for adding a new network (#15176)
* Added metrics for adding a new network

* Applied requested changes

* Added missed changes
2022-07-13 11:47:13 -02:30
Dan J Miller
f785f77959
Improve confirm screen tests (#15163)
* Improve confirm screen tests

* Fix transaction controller unit test

* Fix unit test fixtures

* Fix e2e test
2022-07-12 14:50:20 -02:30
Makoto Inoue
fdd8646ce8
Support for ENS wildcard and offchain resolution (#14675) 2022-07-12 09:30:31 -05:00
Erik Marks
08cc6c5e77
Bump minimum Node.js version to 16 (#15131) 2022-07-02 23:32:18 -07:00
Filip Sekulic
43f7a44c25
Adding popular custom network integration (#14557)
* Initial push

* Refactored the code

* Additional code

* Removed the unused message

* Added a tooltip

* Fixed tests

* Lint fix

* Added style to a tooltip

* Fix e2e test failure

* Lint fix and code revert

* Fix e2e test

* Fixed paddings

* Fixed paddings

* CSS fix

* Minified svg files

* Applied requested changes

* Fixed theme issue

* Code revert

* Added back overridden code

* Icon problem fixed

* Lint fix

* Replaced H3 with H4

* Added unit test

* Added breadcrumbs

* Added const props for networks

* Lint fix

* Lint fix

* Added toggle button for showing the custom network list and resolved few issues

* Fixed routes

* Refactored a piece of code

* Enabled searching for the newly created option

* Fixed unit test

* Updated theme
2022-06-30 13:49:07 -02:30
Dan J Miller
ac7245b50c
Destroy ledger keyring when removing last account in ledger keyring (#14993)
* Destroy ledger keyring when removing last account in ledger keyring

* Update unit tests
2022-06-21 16:33:54 -02:30
Frederik Bolding
82645ba516
[FLASK] snaps-skunkworks@0.16.0 (#14952)
* snaps-skunkworks@0.16.0

* Bump iframe-execution-environment

* Add getAppKey

* Regen LavaMoat policy

* Bump test-snaps
2022-06-20 10:13:12 +02:00
Erik Marks
b491367632
[FLASK] Rename workerController to snapExecutionService (#14981)
Renames the `MetaMaskController.workerController` property to `snapExecutionService`, which better matches the naming scheme used throughout the Snaps codebase. No functional changes.
2022-06-19 10:15:02 -07:00
Jyoti Puri
843beb6d20
MV3: fix injection of applyLavamoat variable in service worker (#14920) 2022-06-18 12:40:30 +05:30
Frederik Bolding
4048feeaac
Increase likelyhood of valid method signatures being returned by getMethodData (#14937)
* Increase likelyhood of valid method signatures being returned by getMethodData

* Update coverage

* Update coverage

* Update coverage

* add a migration to clear knownMethodData

* Small typo changes

Co-authored-by: Alex <adonesky@gmail.com>
2022-06-17 23:11:09 +02:00
Olusegun Akintayo
4b9e84aa20
Only have timeout for when payload is getState (#14972)
* Only have timeout for when payload is getState

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

* Fix test

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2022-06-17 15:04:44 +04:00
Ariella Vu
ac956c43d8
MetaMetrics: Fixes TypeError: Object.values(...).reduce(...).flat is not a function (#14962)
* metametrics: flat is not a function

* MetaMetrics: shorten array logic
2022-06-15 14:52:32 -05:00
Jyoti Puri
d8e1961fd1
MV3: Fix dynamic file list injection on service worker reload (#14795) 2022-06-15 20:27:51 +05:30
Olusegun Akintayo
88286664b5
Fix for: Invalid transaction envelope type: specified type "0x0" but including...requires type: "0x2" (#14823)
* we should not call normalize if we're failing the transaction
refactor out update history
we should fail if un update we get an error and the warning message is
    error submitting.

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

* refactor _setTransactionStatus

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2022-06-13 20:49:18 +04:00
Micaiah Reid
8930df7951
Allow locally hosted RPC and Block Explorer Urls with wallet_addEthereumChain (#14272)
* add function to check if url is localhost

* allow localhost rpcUrls in `wallet_addEthereumChain`

* allow localhost blockExplorerUrls

* wrap new URL in try/catch
2022-06-10 15:53:36 +01:00
Daniel
b0557daa05
Handle an RPC provider delay in Swaps (#14821)
* Return an estimated amount for a completed swap if an RPC provider has a delay

* Create a recursive function for updating post tx balance

* Add a few tests for the "getSwapsTokensReceivedFromTxMeta" fn

* Trigger Build
2022-06-08 16:32:04 +02:00
Olusegun Akintayo
4fa4930c8a
Add friendly error handling when background throws an error before listening for connection (#14461)
* When background port closes, UI should display a user friendly error.

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

Remove console.log

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

A couple of fixes
    1. Use timeout in metaRPCClientFactory to check if UI can't
       communicate with bg
    2. Refactor locale setup
    3. Fixed wording/capitalization
    4. Fix locales usage so that linting works
    5. Refactor CSS

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

do not simulate errorwq

Refactor loading css

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

Remove the onDisconnect event handler in ui as this is handled in
metarpcclientfactory

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

Do not throw in bg

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

Fix PR comments

Remove unused message 'failedToLoadMessage'

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

Move usage of locales to shared/** so that linter can see it.

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

Do not simulate error.

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

metarpc can handle multiple requests, responseHandled should be a map.

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

reload metamask button on critical error

Use metamask state (if available) to the locale, else read locale files
manually.

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

use constant and numeric separator

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

refactor error utils

remove error simulation

Memoize setupLocale function

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

test cases

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

Do not simulate error

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

1. store should be metamask state
2. code refactorings.
Tests: mock setupLocale

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

Mock fetchLocale instead
Test setup locale

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

UI/CSS changes.

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

Do not simulate failure

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

* spell MetaMask correctly

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

* Rename state to mockStore

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

* we should clean up this.responseHandled[id] in the error case.

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

* Fixed PR comments.

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

* clean up response handled.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2022-06-08 00:37:15 +04:00
Mark Stacey
43bd885be7
Merge pull request #14840 from MetaMask/master-sync
Sync `master` with `develop`
2022-06-03 14:34:06 -02:30
George Marshall
87bba78d1f
Updating all instances of Metamask to MetaMask in content, comments and tests (#14848) 2022-06-03 09:32:50 -07:00
Mark Stacey
e6d5af5f9a Merge remote-tracking branch 'origin/develop' into master-sync
* origin/develop: (131 commits)
  Update `protobufjs` and remove obsolete advisory exclusion (#14841)
  Include snap version in pill (#14803)
  Update PULL_REQUEST_TEMPLATE.md (#14790)
  fix: keystone transaction qrcode has no white spacing (#14798)
  Snap notifications integration (#14605)
  Upgrade @metamask/eth-ledger-bridge-keyring (#14799)
  snaps-skunkworks@0.15.0 (#14772)
  Fix proptype errors in network dropdown, tx list item details, and account details modal tests (#14747)
  Ensure transaction type is correctly updated on edit (#14721)
  Add fiat onboarding for AVAX and MATIC through Wyre (#14683)
  Bump @metamask/contract-metadata from 1.33.0 to 1.35.0 (#14791)
  Slight cleanup of constants/transactions, useTransactionDisplayData, and TransactionIcon (#14784)
  Migrate the "estimateGas" API call to "getFees" for STX (#14767)
  Ignore advisory GHSA-wm7h-9275-46v2 (#14789)
  Adding flag for MV3 (#14762)
  Add types to send state (#14740)
  Remove site origin on snap install (#14752)
  Update design tokens library from 1.5 to 1.6 WIP (#14732)
  Enables the "Safe Transaction From" copy for safeTransferFrom transactions (#14769)
  remove draft transaction (#14701)
  ...
2022-06-03 11:53:40 -02:30
Mark Stacey
cf5db650fe Merge remote-tracking branch 'origin/master' into Version-v10.14.7
* origin/master: (101 commits)
  Updating changelog
  Add token standard to custom token details (#14506)
  Revert "Dark Mode: What's New Announcement (#14346)"
  Ensure network name in confirm page container is defined (#14520)
  Updating lavamoat policies
  Fix the alerts toggles in settings (#14498)
  Disable swaps whenever the environment is not development or testing, so that behaviour follows production for QA purposes (#14499)
  [skip e2e] Updating changelog for v10.14.0 (#14487)
  Version v10.14.0
  Docs - segment metrics (#14435)
  Add snaps view search (#14419)
  Run main, flask and beta in sequence in generate-lavamoat-policies.sh (#14470)
  Modify import SRP page (#14425)
  Dark Mode: Implement Metrics (#14455)
  HoldToRevealButton component (#13785)
  e2e test import json file as import account strategy (#14449)
  MetaMetrics: Identify 'number_of_tokens' user trait (#14427)
  MetaMetrics: Identify 'nft_autodetection_enabled' &  'opensea_api_enabled' (#14367)
  Swaps: Sort "token_from" dropdown tokens by their fiat value first and "token_to" by top tokens (#14436)
  Update segment instantiation check. Only check if SEGMENT_WRITE_KEY exists (#14407)
  ...
2022-06-02 18:30:23 -02:30
Guillaume Roux
b599035a12
Snap notifications integration (#14605)
* begin controller implentation

* add NotificationController

* create selectors and actions

* update actions tu use forceUpdateMetamaskState

* Basic notification UI

* fix typo and remove console.log

* lint

* more css

* add notifications scroll

* add translations and fix some css

* Fix rebase and edit colors

* add flask tags

* add flask tag to routes component

* add missing flask tags

* add tests

* fix tests

* store notification expiration delay in constant

* address requested changes

* rename to unreadNotificationsCount

* add missing flask tag
2022-06-01 19:09:13 +02:00
Frederik Bolding
7ce4868401
snaps-skunkworks@0.15.0 (#14772)
* snaps-skunkworks@0.15.0

* Update patch

* Update tofu and LavaMoat policy
2022-06-01 11:26:12 +02:00
Dan J Miller
8961ea5d1b
Ensure transaction type is correctly updated on edit (#14721)
* updated state on edit

* Update transaction type in updateEditableParams method instead of in the send duck

* Fix unit test

* Fix unit tests

* Fix and improve unit tests

Co-authored-by: dragana8 <dragana.simic@consensys.net>
2022-05-27 14:01:31 -02:30
benlwyre
f6643e853c
Add fiat onboarding for AVAX and MATIC through Wyre (#14683) 2022-05-27 11:04:26 -05:00
Daniel
6dbb2c4ded
Migrate the "estimateGas" API call to "getFees" for STX (#14767) 2022-05-26 19:56:28 +02:00
Jyoti Puri
25082ae272
Adding flag for MV3 (#14762) 2022-05-26 10:18:23 +05:30
Brad Decker
5444474d82
add gas_used to gasParams for conversion (#14627) 2022-05-18 16:54:38 -05:00
Frederik Bolding
66c049bb35
snaps-skunkworks@0.14.0 (#14700)
* snaps-skunkworks@0.13.0

* snaps-skunkworks@0.14.0

* Fix test

* Add long-running permission copy and icon

* Run linting

* Fix typo

* Bump E2E version
2022-05-18 13:49:26 +02:00
Mark Stacey
d1ac1a8389 Rename phishing warning page environment variable
The phishing warning page URL environment variable has been renamed
from `PHISHING_PAGE_URL` to `PHISHING_WARNING_PAGE_URL`. We call this
page the "phishing warning page" everywhere else, and this name seemed
better suited (it's not a phishing page itself).

The variable has been listed and documented in `.metamaskrc.dist` as
well.
2022-05-16 18:48:20 -02:30
Mark Stacey
7199d9c567 Use externally hosted phishing warning page
An externally hosted phishing warning page is now used rather than the
built-in phishing warning page.The phishing page warning URL is set via
configuration file or environment variable. The default URL is either
the expected production URL or `http://localhost:9999/` for e2e testing
environments.

The new external phishing page includes a design change when it is
loaded within an iframe. In that case it now shows a condensed message,
and prompts the user to open the full warning page in a new tab to see
more details or bypass the warning. This is to prevent a clickjacking
attack from safelisting a site without user consent.

The new external phishing page also includes a simple caching service
worker to ensure it continues to work offline (or if our hosting goes
offline), as long as the user has successfully loaded the page at least
once. We also load the page temporarily during the extension startup
process to trigger the service worker installation.

The old phishing page and all related lines have been removed. The
property `web_accessible_resources` has also been removed from the
manifest. The only entry apart from the phishing page was `inpage.js`,
and we don't need that to be web accessible anymore because we inject
the script inline into each page rather than loading the file directly.

New e2e tests have been added to cover more phishing warning page
functionality, including the "safelist" action and the "iframe" case.
2022-05-16 14:40:50 -02:30
Brad Decker
ae4efef43e
add networks without ticker trait (#14607)
* add networks without ticker trait
2022-05-13 12:01:29 -05:00
Lachlan Tweedie
eee4cc3100
Add Coinbase Pay as fiat onramp option (#14648) 2022-05-12 18:27:49 -05:00
Hassan Malik
a3917763d4
Removed onExecutionEnvironmentError (#14698)
* used correct method to stop snap

* removed dead code, snap controller already subscribes to execution environment errors

* fixed linting error
2022-05-12 17:58:37 -04:00
Dan J Miller
8948018e5a
Ensure ledger keyring message event listener are removed on metamask lock (#14691)
* Ensure ledger keyring message event listener are removed on metamask lock

* Clean up
2022-05-12 13:36:14 -02:30
Niranjana Binoy
6c757ab5e0
Event tracking for Token Detection V2 (#14441) 2022-05-11 16:27:58 -04:00
Frederik Bolding
b258cbafe7
Remove confirmation for terminated snaps (#14566) 2022-05-11 16:15:26 +02:00
Frederik Bolding
2dac88cbf4
snaps-skunkworks@0.12.0 (#14670)
* snaps-skunkworks@0.12.0

* Bump iframe execution environment

* Remove policy override

* Rerun LavaMoat

Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
2022-05-10 23:08:42 -07:00
Daniel
2bd7127433
Swaps / STX improvements (#14622) 2022-05-09 18:48:14 +02:00
Frederik Bolding
9e401b14bf
Simplify removeSnap functionality after snaps-skunkworks update (#14646) 2022-05-09 18:19:34 +02:00
Alex Donesky
4550a10d32
fix incorrect casing of includeUsdRate option passed to CurrencyRateController (#14615) 2022-05-05 16:14:06 +02:00
Brad Decker
564ad2f81b
Track send flow history on txMeta (#14510) 2022-05-04 11:54:46 -05:00
Ariella Vu
f926925b3f
metametrics: deprecate flatMap (#14608) 2022-05-03 16:17:08 -07:00
Mark Stacey
23e3f52a04
Update version parsing to allow rollback release (#14288)
* Update version parsing to allow rollback release

When we want to rollback a release on Chrome, sometimes we use the
fourth part of the version for the rollback release. This is because
the Chrome web stores does not directly allow rolling back, but instead
requires us to re-submit the release we want to roll back to with a
higher version number.

The manifest version parsing now allows for a fourth version part.

The comments have also been updated to be more descriptive, and to fix
a minor inaccuracy.

* Fix typo in comment

Co-authored-by: David Walsh <davidwalsh83@gmail.com>

Co-authored-by: David Walsh <davidwalsh83@gmail.com>
2022-05-03 14:18:36 -02:30
Mark Stacey
0110bd9571 Fix lint errors 2022-05-03 14:06:02 -02:30
kumavis
c1ca70d732 phishing-detect - validate redirect url protocol 2022-05-03 13:39:18 -02:30
Shane
7da6c66ea2
Added getAccounts suppressUnauthorized param (#14126)
* Added getAccounts suppressUnauthorized param

* Changed getAccounts supresss unauth param name

* Changed getAccounts param to object

* Fixed default empty obj for getAccounts getPermittedAccounts param

* Bump eth-json-rpc-middleware version to 8.0.2

* Fixed lavamoat policy

* Fixed lavamoat policies

* Fixed dedupe issues

* Fixed lavamoat allowscripts

* yarn deduplicate

* Fixed lavamoat policies

Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
2022-04-29 06:05:14 -07:00
Frederik Bolding
1624af2364
snaps-skunkworks@0.11.1 (#14531)
* snaps-skunkworks@0.11.0

* Update LavaMoat policies

* Fix breaking changes

* Use SnapController:clearSnapState

* Fix fetch properly

* Bump iframe execution environment

* snaps-skunkworks@0.11.1

* Run allow-scripts auto
2022-04-28 18:17:28 +02:00
Guillaume Roux
6309d53650
Dark Mode : Add OS option in theme selection dropdown (#14379) 2022-04-28 14:36:28 +02:00
Hennadii Ivtushok
72d2977e72
Warn about multiple MetaMask instances running (#13836)
* Add text warning on startup page

* Try to detect extensions with browser API

* Setup messaging between different versions of extension

* Cleanup

* Cleanup

* Simplify check for multiple instances running

* Fix a doc string + use webextension-polyfill

* Fix test

* Mock webextension-polyfill

* Mock correctly

* Catch error and show warning in both extensions

* Mock as promise

* Address comments

* Rename build ids

* Run detection code only if Chrome

* Add Firefox warnings

* Cleanup imports

* Update connection ids

* Run detection code for Firefox

* Add test

* Add missing await

* Update tests

* Cleanup

* Cleanup

* Improve testing

* Improve tests

* Log errors from sendMessage

* Cleanup

Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
2022-04-27 20:14:10 +02:00
Shane
74b5401302
Fixed API for watchAsset (#14545)
* Fixed API for watchAsset

* Fixed boolean return value for watchAsset
2022-04-27 07:47:10 -07:00
Frederik Bolding
27ad7279cd
Rename NotificationController to AnnouncementController (#14389)
* Rename NotificationController to AnnouncementController

* Fix test

* Add test for missing NotificationController state

* Bump controllers

* Move test to correct file

* Rename config key

* Add migration 71 to list of migrations

* Fix selector after migration
2022-04-27 10:36:32 +02:00
Brad Decker
193c22588e
call controller methods directly in send duck (#14465) 2022-04-26 12:07:39 -05:00
Brad Decker
f567a3fe86
Do not show failed off-chain transactions details when grouped with another valid transaction of same nonce (#14497)
* fix failed off chain tx mismatch with next confirmed transaction

* dont drop failed txs when tx in confirmed

* add comment for reassigning logic

* resolve change requests
2022-04-25 14:39:34 -05:00
Ariella Vu
78f4684b2a
MetaMetrics: Add EVENT.CATEGORIES const (#14474)
* MetaMetrics: add EVENT.CATEGORIES const

* MetaMetrics: add EVENT.CATEGORIES.INPAGE_PROVIDER

* MetaMetrics: add EVENT.CATEGORIES.AUTH

* MetaMetrics: add EVENT.CATEGORIES.ACCOUNTS pt. 1

* MetaMetrics: add EVENT.CATEGORIES.ACCOUNTS pt. 2
confirm we want to use 'Accounts' instead of 'Account'

* MetaMetrics: add EVENT.CATEGORIES.MESSAGES

* MetaMetrics: add EVENT.CATEGORIES.RETENTION const

* MetaMetrics: add EVENT.CATEGORIES.SETTINGS

* MetaMask: add missing EVENT.CATEGORIES.SNAPS

* MetaMetrics: add EVENT.CATEGORIES.WALLET const

* MetaMetrics: add EVENT.CATEGORIES.ONBOARDING const

* MetaMetrics: add EVENT.CATEGORIES.ONBOARDING
& EVENT.CATEGORIES.TRANSACTIONS consts

* MetaMetrics: use EVENT.CATEGORIES

* ducks/swaps: revert slice name

* MetaMetrics: add missing EVENT.CATEGORIES.NETWORK
2022-04-22 13:09:10 -03:00
Ariella Vu
d0ed2c1afc
MetaMetrics: add 'number_of_nfts' user trait (#14495)
* MetaMetrics: add number_of_nfts trait

* MetaMetrics: memoize _getAllNFTAddresses

* MetaMetrics: fix lint / update JSDoc comments

* MetaMetrics: update nft trait logic
- https://github.com/MetaMask/metamask-extension/pull/14495#discussion_r855450898

* MetaMetrics: rn _getAllNFTs > _getAllNFTsFlattened
2022-04-21 18:46:12 -03:00
Alex Donesky
fbeae57247
Add testnet name as prefix for native currency of preloaded testnets (#14454)
* add testnet name as prefix for native currency of preloaded testnets
2022-04-21 14:09:41 -05:00
Erik Marks
cef95f8733
Stop storing request and response objects in the permission activity log (#14485)
We currently store the JSON-RPC request and response objects in the permission activity log. The utility of doing this was always rather dubious, but never problematic. Until now.

In Flask, as the restricted methods have expanded in number, user secrets may be included on JSON-RPC message objects. This PR removes these properties from the permission activity log, and adds a migration which does the same to existing log objects. We don't interact with the log objects anywhere in our codebase, but we don't want unexpected properties to cause errors in the future should any log objects be retained.

This PR also updates relevant tests and test data. It makes a minor functional change to how a request is designated as a success or failure, but this should not change any behavior in practice.
2022-04-21 08:44:15 -07:00
David Walsh
6a06374784 Dark Mode: Implement Metrics (#14455) 2022-04-19 13:38:44 -02:30
David Walsh
bcdd52f55a
Dark Mode: Implement Metrics (#14455) 2022-04-18 11:31:44 -05:00
Ariella Vu
21e54f4717
MetaMetrics: Identify 'number_of_tokens' user trait (#14427)
* MetaMetrics: identify number_of_tokens

* MetaMetrics: update number_of_tokens
do not filter by unique addresses.
Each token contract x chain id combo is a unique contract

* MetaMetrics: update MetaMetricsTraits @typedef
- add number_of_tokens

* MetaMetrics: clean up number_of_tokens

* MetaMetrics: alphabetize in test
2022-04-15 13:35:07 -03:00
Ariella Vu
e7bb8e2663
MetaMetrics: Identify 'nft_autodetection_enabled' & 'opensea_api_enabled' (#14367)
* MetaMetrics: alphabetize traits

* MetaMetrics: identify nft_autodetection_enabled

* MetaMetrics: identify opensea_api_enabled

* metametrics.test: alphabetize traits

* metametrics.test: add new traits
- nft_autodetection_enabled
- opensea_api_enabled

* MetaMetrics: @property use string literals

* MetaMetrics.test: update with openSeaEnabled & useCollectibleDetection

* MetaMetrics: alphabetize

* MetaMetrics: update MetaMetricsTraits @typedef
- add nft_autodetection_enabled
- add opensea_api_enabled
2022-04-15 10:39:55 -03:00
Ariella Vu
0c52723885
Update segment instantiation check. Only check if SEGMENT_WRITE_KEY exists (#14407)
* segment: instantiate w/out SEGMENT_HOST check

If SEGMENT_HOST is null, then the analytics-node library will usea defaulted host

* Segment: rm IN_TEST check for instantiation
2022-04-14 18:31:54 -03:00
kumavis
54ac00027b unblock ci: update vuln deps + fix npm registry for snaps firefox (#14437)
* dep-audit-fix for async@2.6.3

* deps - update async for vuln fix and remove patch

* deps/ci-yarn-audit - remove outdated ignored vulns

* deps/lock - deduplicate async@2

* deps/lock - deduplicate async@2 + remove indirectly used dep

* Use regular NPM registry for snaps on Firefox (#14439)

* Use regular NPM registry for snaps on FF

* Fix linting

* Update app/scripts/metamask-controller.js

Co-authored-by: Shane <jonas.shane@gmail.com>

Co-authored-by: kumavis <kumavis@users.noreply.github.com>
Co-authored-by: Shane <jonas.shane@gmail.com>

Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
Co-authored-by: Shane <jonas.shane@gmail.com>
2022-04-14 08:03:13 -07:00
kumavis
0f4417684b
unblock ci: update vuln deps + fix npm registry for snaps firefox (#14437)
* dep-audit-fix for async@2.6.3

* deps - update async for vuln fix and remove patch

* deps/ci-yarn-audit - remove outdated ignored vulns

* deps/lock - deduplicate async@2

* deps/lock - deduplicate async@2 + remove indirectly used dep

* Use regular NPM registry for snaps on Firefox (#14439)

* Use regular NPM registry for snaps on FF

* Fix linting

* Update app/scripts/metamask-controller.js

Co-authored-by: Shane <jonas.shane@gmail.com>

Co-authored-by: kumavis <kumavis@users.noreply.github.com>
Co-authored-by: Shane <jonas.shane@gmail.com>

Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
Co-authored-by: Shane <jonas.shane@gmail.com>
2022-04-13 17:28:03 -10:00
Brad Decker
922ebd57cb
track address book usage (#14382)
* track address book usage

* Update app/scripts/controllers/metametrics.js

Co-authored-by: Ariella Vu <20778143+digiwand@users.noreply.github.com>

* Update shared/constants/metametrics.js

Co-authored-by: Ariella Vu <20778143+digiwand@users.noreply.github.com>

Co-authored-by: Ariella Vu <20778143+digiwand@users.noreply.github.com>
2022-04-13 11:46:49 -05:00
Niranjana Binoy
455d4a9825
Update DetectTokenController for token detection V2 (#14216) 2022-04-13 12:23:41 -04:00
Olusegun Akintayo
9bd391a35f
User trait - number of nft collections (#14377)
* Add new user trait for 'Number of NFT collections'.

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

FIx JS DOC

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

Arrange TRAITS in alphabetical order

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

Unit Tests for allCollectibles traits tracking.

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

change cid to chainId

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

* invert condition

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

* jsdoc - alphabetical order

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

* change {string} to the literal {number_of_nft_collections}

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

* Optimize _getNumberOfNFTs

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2022-04-10 11:42:00 +04:00
Daniel
2d24a4d643 Swaps timer improvements, optional refresh rates and fix for a notification UI (#14300)
* Set up correct timer value for fetching new quotes

* Show red timer in Swaps if quotes fetching will happen in less than 10s (previously it was 30s)

* Fix a UI issue with the notification close button

* Make stx refresh rates optional, since not every network supports them
2022-04-07 03:01:50 -07:00
ryanml
b8c9f370ef Merge remote-tracking branch 'origin/master' into Version-v10.13.0 2022-04-07 02:32:07 -07:00
Mark Stacey
831d274a40 Restore version missing from certain build steps (#14344)
Certain build steps accidentally omitted the `version` variable. It has
now been restored to all steps, ensuring that all environment variables
are correctly injected into all bundles.

A check has been added to the Sentry setup module to ensure the release
is not omitted in the future.
2022-04-04 21:06:12 -02:30
Brad Decker
d6df3700f7
track rpc method usage (#14269) 2022-04-04 14:26:13 -05:00