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

1138 Commits

Author SHA1 Message Date
David Walsh
2822379bdc
Improve browser detection code (#12456)
* Improve browser detection code

* Add unit tests for platform detection

* Add test

* Use key check instead of object presence
2021-11-05 17:28:44 -07:00
Mark Stacey
345ed9f6f2
Add build type to Sentry environment (#12441)
The build type (i.e. the distribution) is now included in the Sentry
environment during setup, for all builds except the "main" build. This
will allow us to track Flask and beta errors separately from other
errors.

A constant was created for the build types. The equivalent constant in
our build scripts was updated to match it more closely, for
consistency. We can't use the same constant in both places because our
shared constants are in modules that use ES6 exports, and our build
script does not yet support ES6 exports.

The singular `BuildType` was used rather than `BuildTypes` to match our
naming conventions elsewhere for enums. We name them like classes or
types, rather than like a collection.

Relates to #11896
2021-10-25 14:27:30 -02:30
Alex Donesky
22378e4f72
fix issue where regional locales are not matched against our locales list (#12403)
* fix issue where regional locales are not matched against our locales list
2021-10-19 14:32:13 -05:00
Thomas Huang
02a4da9ad2
Fix 12145 - Ledger errors being set as Error: [object, object] (#12176)
* Fixes #12145

When transactions fail, preserve error message when presented with an error object. Fallback to stringified error for other cases.

* Perserve error stack when err.stack is present, else set stack to message.

* Use optional chaining
2021-09-22 10:41:23 -07: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
Shane
362b54b2dd
Added getPersistentState support for V2 controllers persist metadata (#12007) 2021-09-05 19:33:37 -07:00
Alex Donesky
33849bfec6
Fix issue with chainId comparison in sign typed message param validation (#11900) 2021-08-24 11:23:29 -05:00
Peter-Jan Brone
3fada25dfc
Add Skylink support to ENS resolver (#11401)
* Add Skynet support to ENS to IPFS resolver

* Remove newline

* Fix lint

* Fix lint

* Remove mistakenly committed zip file

* Update
2021-07-16 10:22:04 -05:00
Dan J Miller
932444c355
Ensure transaction controller correctly estimates gas for special custom networks (#11441) 2021-07-02 13:01:27 -02:30
Daniel
a1d7271ed7
Call Wyre’s API via our backend to generate Wyre’s Checkout URL (#11387)
* Call Wyre’s API via our backend to generate Wyre’s Checkout URL

* Add back paymentMethod=debit-card, use a fallback URL if no url is returned from BE

* Fix a lint issue

* Refactor how to return Wyre’s Checkout URL

* Add 2 constants into a test file, refactoring
2021-06-25 09:52:29 -05:00
Brad Decker
cb652c0fae
remove unused sufficient balance method (#11381)
this method relied on gasPrice being present and is safe to remove
2021-06-25 09:52:18 -05:00
Daniel
ba3f51d6ed
Add support for fiat on-ramp via Transak (#11376) 2021-06-25 08:10:24 -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
23f0270af2
add back strict equality checks in typed-message-manager, ensure that chainId comparison bases are both ints (#11340) 2021-06-23 16:32:23 -05:00
Alex Donesky
be98e05c58
patch breaking change in signTypeData param validation (#11309) 2021-06-15 13:17:38 -05:00
ryanml
2bfc3a093f
Using values from shared/constants/time to represent timing values (#11241) 2021-06-10 12:27:03 -07:00
ryanml
a75092762f
Fix built-in networks switch-ethereum-chain, Including RPC url in switchEthereumChain requestData (#11268)
* Moving RPC Urls to network constants

* Including RPC url in switchEthereumChain requestData

* Setting project id to var

* Fix built-in networks switch-ethereum-chain

`switch-ethereum-chain` did not work correctly with built-in networks.
It was treating them as custom networks, rather than as built-in
networks. This affected how they were displayed in the network
dropdown, and resulted in slight differences to the network stack used
as well.

The problem was that `updateRpcTarget` was used, which was meant for
custom networks only. Now that `setProviderType` is used in the case of
a built-in network, the behaviour should match the network switcher
exactly.

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-06-09 15:18:38 -07:00
ryanml
3242710f3d
Supporting existing default networks in switchEthereumChain (#11184) 2021-05-26 09:17:18 -07:00
Mark Stacey
5009ceae53
Migrate to new CurrencyRateController (#11005)
The CurrencyRateController has been migrated to the BaseControllerV2
API, which includes various API changes. These changes include:
* The constructor now expects to be passed a
`RestrictedControllerMessenger`.
* State changes are subscribed to via the `ControllerMessenger` now,
rather than via a `subscribe` function.
* The state and configration are passed in as one "options" object,
rather than as two separate parameters
* The polling needs to be started explicitly by calling `start`. It
can be stopped and started on-demand now as well.
* Changing the current currency or native currency will now throw an
error if we fail to update the conversion rate.

The `ComposableObservableStore` has been updated to accomodate these
new types of controllers. The constructor has been updated to use an
options bag pattern as well, to make the addition of the new required
`controllerMessenger` parameter a bit less unweildly.
2021-05-20 00:27:51 -02:30
Mark Stacey
37dc19a352
Migrate Sentry settings to environment variables (#11085)
Sentry is now configured with environment variables, rather than with
hard-coded values. This makes it easier to test Sentry functionality
using a different Sentry account, as we did recently during QA of
v9.5.1.

The only change for the normal build process is the introduction of the
`SENTRY_DSN_DEV` variable, which can be set via `.metamaskrc` or via an
environment variable. This determines where error reports are sent. It
still defaults to our team Sentry account's `metamask-testing` project.

The `sentry:publish` script now requires SENTRY_ORG and SENTRY_PROJECT
to be set in order to publish release artifacts. The CircleCI
configuration has been updated with these values, so it should act the
same as it did before. Previously we had used a CLI flag to specify the
organization and project, but Sentry already natively supports these
environment variables [1].

[1]: https://docs.sentry.io/product/cli/configuration/#configuration-values
2021-05-18 13:56:22 -02:30
Shane
abba7f4159
fix metaRPCClientFactory id handling (#11116)
* fix metaRPCClientFactory id handling
2021-05-17 14:46:00 -07:00
Brad Decker
9386e3cb03
create safer isValidAddress method (#11089) 2021-05-17 14:00:59 -05:00
Shane
cacefc72fc
return early from metaRPCHandler if stream has ended (#11065)
* return early from metaRPCHandler if stream has ended

* add write after end guard to handleUpdate
2021-05-12 15:12:46 -07:00
Mark Stacey
89ef78674d
Replace uses of hasOwnProperty.call with simpler alternatives (#11009)
Three uses of `hasOwnProperty.call` have been replaced with simpler
alternatives. I did this because I found this convention confusing.

The `ComposableObservableStore` changes required adding a check for
whether the `config` is defined, because the old syntax would allow
iterating over `undefined` as if it was an empty object. Functionally
it should be identical. A new test was added to highlight this
functionality.
2021-05-11 14:09:17 -02:30
Erik Marks
35531d8360
Fix error behavior of addEthereumChain (#11031) 2021-05-11 09:34:52 -07:00
Erik Marks
2289e47e87
Update switchEthereumChain unrecognized chain error (#11030) 2021-05-10 15:29:07 -07:00
Brad Decker
c188e3fda0
rough in switchEthereumChain (#10905) 2021-05-10 14:14:21 -05:00
Mark Stacey
f47cfbbb3e
Use strict assertion mode everywhere (#11012)
The `assert` module has two modes: "Legacy" and "strict". When using
strict mode, the "strict" version of each assertion method is implied.
Whereas in legacy mode, by default it will use the deprecated, "loose"
version of each assertion.

We now use strict mode everywhere. A few tests required updates where
they were asserting the wrong thing, and it was passing beforehand due
to the loose matching.
2021-05-07 17:08:24 -02:30
Brad Decker
f1825e850d
use one segment instance (#10915) 2021-04-26 11:05:43 -05:00
Brad Decker
d1f8171877
upgrade ethereumjs util (#10886) 2021-04-16 10:05:13 -05:00
kumavis
bfdc1e68f5
Delete setupFetchDebugging.js (#10636)
* Delete setupFetchDebugging.js

* remove fetch-debugging (now handled corrently by sentry)
2021-03-23 18:05:49 +08:00
Brad Decker
a81629e104
refactor incoming tx controller (#10639) 2021-03-19 16:54:30 -05:00
Shane
b50fe3184a
fix: replace dnode background with JSON-RPC (#10627)
fixes #10090
2021-03-18 11:23:46 -07:00
Brad Decker
5a233e4634
colocate tests in flat structure (#10655) 2021-03-16 16:00:08 -05:00
Brad Decker
3d4dfc74a8
prefer chainId over networkId in most cases (#10594) 2021-03-12 16:23:26 -06:00
Niranjana Binoy
84b1379b40
Setting balance to 0x0 when the original value is undefined (#10634) 2021-03-12 10:20:33 -05:00
Brad Decker
1a2dc850a3
addEthereumChain bug fixes (#10520) 2021-02-25 16:25:51 -06:00
Brad Decker
15d78b8158
use chain id for enabling ENS IPFS resolution (#10507) 2021-02-25 05:40:57 -06:00
Brad Decker
aaec480e32
fix misuse of getCurrentNetwork (#10504) 2021-02-23 12:33:33 -06:00
Brad Decker
823466b62a
Re-add handler for addEthereumChain (#10489) 2021-02-23 10:32:46 -06:00
Brad Decker
1d23b59af3
add Custom Network Added event (#10484) 2021-02-23 09:58:35 -06:00
Erik Marks
e48053a6d5
Add custom network RPC method (#9724)
Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
Co-authored-by: Brad Decker <git@braddecker.dev>
2021-02-12 09:25:58 -06:00
Brad Decker
19fa2f5962
cancel unapproved confirmations on network change (#10357) 2021-02-08 17:22:30 -06:00
Erik Marks
76a2a9bb8b
@metamask/eslint config@5.0.0 (#10358)
* @metamask/eslint-config@5.0.0
* Update eslintrc and prettierrc
* yarn lint:fix
2021-02-04 10:15:23 -08:00
Erik Marks
7ebab83e40
Fix logWeb3ShimUsage metrics (#10286) 2021-01-25 14:20:44 -08:00
Erik Marks
30ff153103
eth-rpc-errors@4.0.2 (#10226) 2021-01-20 22:06:41 -08:00
Erik Marks
4fef2b7443
Add MAX_SAFE_CHAIN_ID and refactor chain ID validation (#10224)
* Add MAX_SAFE_CHAIN_ID constant
* Add isSafeChainId to shared utils module
* Move isPrefixedFormattedHexString to shared utils module
* Validate custom RPC chain IDs in network controller
* Update some network controller error messages.
* Add isSafeChainId validation to UI
2021-01-20 15:37:18 -08:00
Erik Marks
90289ec22a
Further improve organization of constants (#10200) 2021-01-20 08:13:14 -08:00
Erik Marks
7159dd6867
Fetch with a timeout everywhere (#10101)
* Use fetchWithTimeout everywhere
* Memoize getFetchWithTimeout
* Require specified timeout
2021-01-19 08:41:57 -08:00
David Walsh
c42087d044
Use destructured signal (#10115) 2020-12-23 10:15:07 -06:00