1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/ui/helpers/utils
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
..
optimism ci - enforce yarn lock deduplications (#12737) 2021-11-23 09:17:27 -10:00
build-types.js Add platform-specific build type manifest modifications (#12638) 2021-11-10 19:33:59 -03:30
common.util.js remove the ui/app and ui/lib folders (#10911) 2021-04-28 14:53:59 -05:00
common.util.test.js Update ESLint config to v8 (#12886) 2021-12-09 15:36:24 -03:30
confirm-tx.util.js Only show dapp suggested gas fee warning if user has not edited the fee (#11621) 2021-07-27 20:01:53 -02:30
confirm-tx.util.test.js Add gas constants (#11248) 2021-06-08 10:25:48 -05:00
conversions.util.js Fixes updates on the confirm screen. (#11788) 2021-08-06 14:31:30 -05:00
conversions.util.test.js remove the ui/app and ui/lib folders (#10911) 2021-04-28 14:53:59 -05:00
error-utils.js Add friendly error handling when background throws an error before listening for connection (#14461) 2022-06-08 00:37:15 +04:00
error-utils.test.js Add friendly error handling when background throws an error before listening for connection (#14461) 2022-06-08 00:37:15 +04:00
fetch-with-cache.js Using values from shared/constants/time to represent timing values (#11241) 2021-06-10 12:27:03 -07:00
fetch-with-cache.test.js bump @metamask/controllers to v15.0.2 and remove AbortController workaround in e2e tests (#11988) 2021-09-03 09:34:21 -05:00
formatters.js remove the ui/app and ui/lib folders (#10911) 2021-04-28 14:53:59 -05:00
gas.js Fix speed-up/cancel: don't update existing transaction data (#14355) 2022-04-14 13:20:48 -02:30
gas.test.js Degrade gracefully when gas API is down (#13865) 2022-03-11 11:59:58 -07:00
hardware.js Create function for hardware keyring checking (#12457) 2021-10-27 18:54:18 -05:00
i18n-helper.js Add JSDoc ESLint rules (#12112) 2022-01-07 12:27:33 -03:30
i18n-helper.test.js remove the ui/app and ui/lib folders (#10911) 2021-04-28 14:53:59 -05:00
icon-factory.js Update token detection logic to only control auto-detection (#14251) 2022-04-06 13:59:16 -04:00
is-mobile-view.js Using design system breakpoint values across ui/ 2021-09-11 11:00:46 -07:00
metric.test.js Adding the AdvancedGasFeePopover template (#12780) 2021-11-23 23:16:33 +05:30
metrics.js Adding the AdvancedGasFeePopover template (#12780) 2021-11-23 23:16:33 +05:30
permission.js snaps-skunkworks@0.14.0 (#14700) 2022-05-18 13:49:26 +02:00
settings-search.js Add snaps view search (#14419) 2022-04-19 11:08:09 -04:00
settings-search.test.js Add search information for Theme dropdown (#14476) 2022-05-04 09:57:01 -05:00
storage-helpers.js remove the ui/app and ui/lib folders (#10911) 2021-04-28 14:53:59 -05:00
switch-direction.js Add JSDoc ESLint rules (#12112) 2022-01-07 12:27:33 -03:30
token-util.js Fix issue where we show contract address as recipient when calling safe transfer method on erc721 or erc1155 contracts (#13535) 2022-03-17 13:35:40 -05:00
transactions.util.js Fix issue where we show contract address as recipient when calling safe transfer method on erc721 or erc1155 contracts (#13535) 2022-03-17 13:35:40 -05:00
transactions.util.test.js Fix issue where we show contract address as recipient when calling safe transfer method on erc721 or erc1155 contracts (#13535) 2022-03-17 13:35:40 -05:00
tx-helper.js remove the ui/app and ui/lib folders (#10911) 2021-04-28 14:53:59 -05:00
tx-helper.test.js remove the ui/app and ui/lib folders (#10911) 2021-04-28 14:53:59 -05:00
util.js Degrade gracefully when gas API is down (#13865) 2022-03-11 11:59:58 -07:00
util.test.js "eth_signTypedData" presents fields that do not appear in 'types' filed (#12905) 2021-12-09 00:56:09 +04:00
webcam-utils.js remove the ui/app and ui/lib folders (#10911) 2021-04-28 14:53:59 -05:00