1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
Commit Graph

243 Commits

Author SHA1 Message Date
George Marshall
fa4d884a87
Find and replace of all typography colors to design tokens () 2022-03-09 07:24:53 -08:00
Brad Decker
9cea401022
extract determineTransactionType from tx controller () 2022-03-07 12:54:36 -06:00
Olusegun Akintayo
6d54897cfb
Fixed these issues in v10.11.0 ()
After landing on Swap, a disclaimer of Smart Transactions appear, and an error on devTools shows the following: “invalid prop ‘type’ of value ‘ul’” supplied to ‘Typography’
    After enabling Smart Transactions, an error on devTools shows the following: “invalid prop ‘smartTransactionsOptInSatus’ of type ‘boolean supplied to ‘SlippageButtons’

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2022-03-02 19:59:31 +04:00
Daniel
42fd5d19f4
Content and UI updates for the STX modal ()
* Update content and UI for STX modal

* Update the main header image for STX

* Capitalize Smart Transactions in the button label
2022-03-01 19:18:20 +01:00
Guillaume Roux
23e6c073c4
Dark Theme setup and button theming ()
* Add design-tokens and apply colors to button

* swap more colors

* tweak button and add dark theme switch to storybook

* tweak buttons

* fix typo

* remove comments

* add dep to ignored list

* fix linting issue

* fix linting issues

* Updating some styles and removing some deprecated buttons ()

* Updating some styles and removing some deprecated buttons

* Warning button fixes

* Fixing warning text for darkmode

* bump design tokens and update storybook theme strategy

Co-authored-by: George Marshall <george.marshall@consensys.net>
2022-02-25 14:11:22 -08:00
Daniel
6dd141ebfd
Small fixes for Swaps ()
* Fix: Insufficient number of substitutions for key "stxSuccessDescription"

* Only calculate "approvalGas" if the "approvalNeeded" param is truthy in a quote

* "Swap from" has to be set to enable "Review Swap", set a default token for "Swap from"

* Fix: Unable to find value of key "undefined" for locale

* Use array destructuring
2022-02-23 22:10:28 +01:00
fadnesscharlie
3d5da527f9
Added Controls and Action ArgType, took out @storybook/addon-knobs ()
* added controls and took out unused code

* Fix Lint Issues
2022-02-21 08:13:11 -06:00
Daniel
2585f45bde
Add support for Smart Transactions () 2022-02-18 17:48:38 +01:00
Daniel
120603e6df
Enable Avalanche for Swaps () 2022-02-18 15:24:47 +01:00
Daniel
cbf8a737dc
Change "Quote X of Y" to "Fetching quote X of Y" ()
* Change "Quote X of Y" to "Fetching quote X of Y"

* Update a test

* Trigger Build
2022-02-17 17:08:53 +01:00
Jyoti Puri
760ed3457d
Removing EIP_1559_V2 feature flag () 2022-02-03 05:58:28 +05:30
Jyoti Puri
cc1861a34e
Adding metrics events for EIP-1559 V2 flow () 2022-02-01 23:23:03 +05:30
thickforest
fd46f97e35
Fix className misspelling in awaiting-swap.js 2022-01-27 14:47:25 -06:00
Jyoti Puri
5b5b2cd7df
Fixing warnings in unit test cases () 2022-01-20 00:04:22 +05:30
Jyoti Puri
88faef7e19
Adding user setting option for EIP-1559 V2 () 2022-01-12 00:47:56 +05:30
Alex Donesky
4826c8c95e
Feat/collectibles send flow ()
* Add collectibles send flow
2022-01-10 10:23:53 -06:00
Mark Stacey
3732c5f71e
Add JSDoc ESLint rules ()
ESLint rules have been added to enforce our JSDoc conventions. These
rules were introduced by updating `@metamask/eslint-config` to v9.

Some of the rules have been disabled because the effort to fix all lint
errors was too high. It might be easiest to enable these rules one
directory at a time, or one rule at a time.

Most of the changes in this PR were a result of running
`yarn lint:fix`. There were a handful of manual changes that seemed
obvious and simple to make. Anything beyond that and the rule was left
disabled.
2022-01-07 12:27:33 -03:30
Elliot Winkler
af971cd5b6
Remove dupe Prettier config from ESLint config ()
The ESLint config for the extension explicitly includes support for
Prettier. However, this is already being provided by our global ESLint
config (`@metamask/eslint-config`). Therefore there is no need to
include it here. In fact, this is causing weird issues where the `curly`
option is getting overridden somehow. After this change, these syntaxes
are invalid:

``` javascript
if (foo) return;
```

``` javascript
if (foo) return 'bar';
```
2022-01-06 15:56:51 -07:00
David Walsh
10dc686505
Dark Mode Part 1: Switch to Using CSS Variables () 2022-01-06 11:35:49 -06:00
Jyoti Puri
f5dcd12293
using 1559 V2 for cancel speed up flows () 2022-01-06 08:17:26 +05:30
Erik Marks
dbfdf3b0eb
Update Flask support links and home footer ()
* Update support links for Flask

* Disable 'prefer-const' in code fence linting

* Add bespoke home footer for Flask and update logic

* fixup! Add bespoke home footer for Flask and update logic

* Fix code fence lint failure

* Fix support request link in account menu

* Fix unit test failure
2022-01-05 21:25:20 -03:30
Jyoti Puri
19c3d021ea
Using EIP-1559 V2 for swaps () 2021-12-12 04:56:28 +05:30
Mark Stacey
ba54a3d83b
Update ESLint config to v8 ()
The ESLint config has been updated to v8. The breaking changes are:

* The Prettier rule `quoteProps` has been changed from `consistent` to
`as-needed`, meaning that if one key requires quoting, only that key is
quoted rather than all keys.
* The ESLint rule `no-shadow` has been made more strict. It now
prevents globals from being shadowed as well.

Most of these changes were applied with `yarn lint:fix`. Only the
shadowing changes required manual fixing (shadowing variable names were
either replaced with destructuring or renamed).

The dependency `globalThis` was added to the list of dynamic
dependencies in the build system, where it should have been already.
This was causing `depcheck` to fail because the new lint rules required
removing the one place where `globalThis` had been erroneously imported
previously.

A rule requiring a newline between multiline blocks and expressions has
been disabled temporarily to make this PR smaller and to avoid
introducing conflicts with other PRs.
2021-12-09 15:36:24 -03:30
Etienne Dusseault
068e97314e
Fix dropdown-input-pair component to for new Storybook format ()
* input pair

* proptype comments

* Update

Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
2021-12-07 09:44:25 -08:00
Matthew Epps
311ea021f3
Optimize rest of swaps flow () 2021-12-07 11:33:13 -06:00
Daniel
c8b697687f
Swaps UI redesign for the View Quote page ()
* Update EIP-1559 UI on the View Quote page (WIP)

* UI redesign for the View Quote page in Swaps, update tests,  refactoring

* Update styles for the View Quote page

* Improve scrolling and styling for the View Quote page

* Update snapshots

* Fix a scrolling issue

* Use Ethereum mainnet for swaps API calls if it's Rinkeby

* UI / content updates on the View Quote page

* Remove unused content in Swaps

* Fix an ESLint issue

* Update UTs with the latest content

* Renaming

* Remove 2 more unused content strings
2021-12-07 00:21:26 -03:30
George Marshall
854fc71ae7
Organizing storybook to echo app folder structure ()
* Organizing storybook to echo app folder structure

* Updating new stories to follow new convention from develop
2021-12-01 11:27:57 -08:00
Matthew Epps
7a92e22111
Swaps optimizations ()
* Trigger Build

* Trigger Build

* Move swaps index variables to redux

* all optimizations so far

* Add better equality checks for selectors in swaps index and build quote

* Clean up PR, remove extra code and logs

* Clean up lavamoat file

* Fixes for optimizations

* Update tests and test snapshots

* Remove unnecessary tests

* Remove unnecessary console log

* Trigger Build

* Trigger Build

* Add delay to account for remote call made by trezor keyring

Co-authored-by: Dan Miller <danjm.com@gmail.com>
2021-12-01 12:55:09 -03:30
Matthew Epps
8e6a0ff879
Send all swaps requests to api2, remove useNewSwapsApi boolean ()
* Send all swaps requests to api2, remove useNewSwapsApi boolean

* Switch token bucket priority

* Fix tests

* Trigger Build

* Trigger Build
2021-11-30 19:56:28 +01:00
George Marshall
07f16d37be
Updating IconWithFallback to functional component, adding stories and docs () 2021-11-24 11:43:22 -08:00
Daniel
ecceb4d6da
Use v2 API for fiat onboarding URL creation, fix wrapping / unwrapping ()
* Use a Swaps v2 API to get a fiat onboarding URL

* Fix an issue with wrapping / unwrapping if an address contained uppercase chars

* Rename a constant

* Use a constant in a test
2021-11-17 18:04:50 +01:00
Olusegun Akintayo
0cf7455e18
addresses an issue found in 10.6.0 QA ()
* addresses an issue found in 10.6.0 QA

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

* update test cases.

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

* Fixes unit test texts to pass

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2021-11-15 18:34:09 -03:30
David Walsh
3f9ec40107
Use gas estimate type constants () 2021-11-10 13:50:43 -06:00
David Walsh
17b64e94fc
Use gas recommendation constants throughout app () 2021-11-05 19:59:23 -05:00
Daniel
e8944e0a5d
Don't show "Unavailable on this network" if Swaps button is enabled ()
* Don't show "Unavailable on this network" if Swaps button is enabled

* Hide a tooltip title if tooltip is disabled

* Update a snapshot
2021-10-28 19:36:04 +02:00
Jyoti Puri
79b08fb803
Refactoring useGasFeeInputs hook ()
Refactoring useGasFeeInputs hook
2021-10-22 22:44:28 +05:30
David Walsh
3f687ff45f
Use ternary conditionals instead of && () 2021-10-21 11:11:31 -05:00
ryanml
308cca1897
Preventing swaps data re-fetch when navigating back to home screeen () 2021-10-18 10:31:34 -07:00
Dan J Miller
18ca9d14e0
Do case-insensitive comparisons of token addresses in view-quote and build-quote () 2021-10-08 18:57:45 -02:30
Niranjana Binoy
68259ee3e2
UX Papercuts Epic: Create a consistent representation of the Buttons () 2021-10-05 15:20:42 -04:00
Matthew Epps
53f2c84209
Add client id to GasFeeController ()
* chore: Add client id to GasFeeController

* chore: change EXTENSION_CLIENT_ID to SWAPS_CLIENT_ID in constants file
2021-09-29 10:41:19 -02:30
Akintayo A. Olusegun
08dff86be0
Add target object word to "View on Etherscan" links ()
* Add target object word to "View on Etherscan" links
Fix for: 

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

* Fix Swap tests checking for View $1 at or View $1 on

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

* Linter Fixes

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

* Fix  ui/hooks/useTransactionDisplayData.test.js expected result should
be May 13, 2020

Update Jest snapshot for view on etherscan test

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

* Add description of the variables in messages.

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

* 1. localize all of the blockExplorerViewAction values
2. Apply this nit. https://github.com/MetaMask/metamask-extension/pull/12100#discussion_r708343532

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

* Lint fixes.

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

* Fix locale value not used on GUI error lint error.

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

* Reverted this commit, on circle ci, the date is May 12.

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

* Add description to link block explore actions to where it's used.

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

* Fix missing messages.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2021-09-24 21:14:07 +04:00
Etienne Dusseault
a86129d23f
fee-card () 2021-09-24 11:47:40 -03:00
Matthew Epps
3ca6202282
Add client id header for Swaps Apis () 2021-09-20 14:06:41 -05:00
kumavis
f472c2615a
CI - add metamaskbot comment "highlights" section for showing relevant storybook changes ()
* ci/announce/highlight - add bot announcement section for "highlights" showing off important diffs + storybook highlights

* ci/announce/highlight - fix announcement message

* Update index.js

* xxx tmp xxx

* ci/announce/highlight - fix dirty file calculation

* ci/announce/highlight - try/catch wrap highlight generation for build stability

* ui - put fox emojis in the mascot component

* ci/announce/highlight - start storybook permalinks

* ci/announce/highlight - fix storybook permalink util

* ci/announce/highlight - fix storybook permalink util

* ci/announce/highlight - small styling fix

* storybook - use any easily predictable story id

* ci/announce/highlight - revert sample commit

* ci/announce/highlight - minimal documentation
2021-09-15 08:55:48 -10:00
ryanml
7895fcb7af
Merge pull request from MetaMask/break-point-overhaul
Using design system breakpoint values across ui/
2021-09-15 10:41:05 -07:00
Daniel
28fc2d471f
Quotes prefetching in Swaps () 2021-09-15 15:13:18 +02:00
ryanml
5c03be009a Fixing breakpoint fallthroughs 2021-09-11 11:13:36 -07:00
ryanml
069ebaf463 Using design system breakpoint values across ui/ 2021-09-11 11:00:46 -07:00
Niranjana Binoy
eb987a47b5
Integrating the TokenListController to Extension () 2021-09-09 16:56:27 -04:00
Daniel
6f0d6b1693
Add support for swaps via a direct contract for wrapping and unwrapping ()
* 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
Daniel
93cdd3c159
Use Swaps dev APIs based on an env variable () 2021-09-08 19:26:37 +02:00
Etienne Dusseault
9f10fe8c97
swaps-gas-customization () 2021-08-30 13:01:59 -10:00
Etienne Dusseault
8d22dc4470
import token () 2021-08-30 13:00:47 -10:00
ryanml
472cf17bda
Adding UI helpers for URL parsing () 2021-08-24 15:28:16 -07:00
Etienne Dusseault
46c4cc1966
Add confirm-add-suggested-token & confirm-add-token components to Storybook ()
* add suggessted token

* lintfix

* lintfix

* silence use effect warning

* download token icons and use paths to avoid web urls

* lintifx

* Add confirm-add-token component to Storyboard ()

* create story for add token

* change code

* add confirm add token story

* lintfix

* Update confirm-add-token.component.js

* Update confirm-add-token.component.js

* different token list for confirm add token

* lintfix

* Update confirm-add-suggested-token.component.js

* remove bnb png

* remove redundant images and fix storybook image path
2021-08-17 00:33:46 -05:00
Etienne Dusseault
435b663f5f
awaiting signature () 2021-08-17 00:30:58 -05:00
David Walsh
01fd2a609e
Gas Timing with Negative attitude should be bold with tooltip () 2021-08-14 17:46:55 -05:00
Daniel
410c4aec9a
Fix Insufficient number of substitutions for key "swapYourTokenBalance" ()
* Fix Insufficient number of substitutions for key "swapYourTokenBalance"

* Use an empty string if there is no default symbol

* Add ? after SWAPS_CHAINID_DEFAULT_TOKEN_MAP[chainId]
2021-08-13 08:26:42 -07:00
Dan J Miller
bfde5a1d77
Fixes updates on the confirm screen. ()
* 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 () 2021-08-05 18:59:58 -05:00
ryanml
7f0b2a81ce
Fall back to aggregator name when icon is unavailable (Swaps Load View) () 2021-08-03 12:09:39 -07:00
David Walsh
c8b3dfe4e9
EIP-1559 - Fall back to gasLimit and gasPrice for hardware wallets () 2021-08-02 17:52:18 -05:00
Daniel
fa703173a0
Fix Jest unit tests ()
* Fix Jest unit tests

* Provider correct getGasFeeTimeEstimate call to Gas Timing

* Fix tests for correct getGasFeeTimeEstimate method name

* Rename instances to getGasFeeTimeEstimate

Co-authored-by: David Walsh <davidwalsh83@gmail.com>
Co-authored-by: Dan Miller <danjm.com@gmail.com>
2021-07-30 15:10:41 -02:30
Daniel
24f5cc009b
Pass "maxFeePerGas" to the <GasTiming> component from Swaps () 2021-07-30 15:19:30 +02:00
Daniel
714170c7b8
EIP-1559 and Rinkeby Testnet support in Swaps () 2021-07-30 13:35:30 +02:00
Daniel
709369dc14
Fix default tooltip color () 2021-07-27 15:20:01 +02:00
Daniel
868d932165
Check for the "fromToken" existance before checking decimals () 2021-07-26 10:15:13 +02:00
Daniel
a17c4462b4
Add token decimals validation in Swaps ()
* Add token decimals validation in Swaps
* Use camelCase
2021-07-22 19:29:31 +02:00
Daniel
594025a198
Add support for Polygon ()
* Fix a check for EIP presense
* Add support for Polygon
* Update default Polygon URL
* Trigger Build
* Use a more user-friendly error message for disabled Swaps API calls
2021-07-20 19:17:15 +02:00
David Walsh
d8984d3cf3
EIP-1559 - Provide Updated UI for Dapp-Suggested Gas fees () 2021-07-16 10:00:03 -05:00
Daniel
d438439661
Swaps: Add conditional routing to new APIs based on a feature flag () 2021-07-09 10:24:00 -05:00
Brad Decker
da9fb4636b
move conversion utils to shared folder () 2021-07-06 12:48:49 -05:00
David Walsh
afe06adb7a
Add icon to actionable message component () 2021-07-02 14:07:56 -05:00
Daniel
8ca0d24f82
Increase Jest unit test coverage for the Swaps feature to ~60% () 2021-07-02 08:48:34 -05:00
ryanml
2bfc3a093f
Using values from shared/constants/time to represent timing values () 2021-06-10 12:27:03 -07:00
Brad Decker
b073b04789
move metamask state selectors out of send () 2021-06-08 11:03:59 -05:00
Daniel
c3b79bb358
Show custom tokens in Swaps, add a custom token in Swaps ()
* Show custom tokens in Swaps

* Add messages for adding a custom token in Swaps

* Add the first version of importing custom tokens in swaps

* Fix lint rules

* Create a new component: ImportToken

* Remove a pointer cursor from regular heading

* Fix a CSS issue for tokens with long names

* Update a comment

* Don’t return a custom token if it doesn’t have symbol or decimals

* Only search by contract address if nothing was found

* Track “Token Imported” event

* Fix unit tests

* Import tracking for “Token Imported”, increase token icon font size

* Disable token import for Source Token

* Update logic and content for notifications, update tests

* Do not hide a dropdown placeholder on click, so a user can click on a link

* Update a key name

* Update styling for the “danger” type notification in Swaps

* Show either a warning or danger notification based on token verification occurences

* Remove testnets from SWAPS_CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP

* Use the “shouldSearchForImports” prop

* Create a new function for handling token import: “onOpenImportTokenModalClick”

* Filter token duplicities before iterating over tokens

* Use “address” instead of “symbol” for checking uniqueness

* Trigger Build

* Use a new API (/token) to get token data for importing in Swaps

* Temporarily decrese Jest threshold for functions
2021-06-03 13:38:37 -02:30
ryanml
ee4df61e91
Fixing ever-present scrollbar issue on Swaps view ()
* Fixing ever-present scrollbar issue on Swaps view

* Updating max-height
2021-05-27 10:27:18 -07:00
Etienne Dusseault
4c341d83ab
Add Approval Confirmation Screen component to Storybook ()
* add metametrics wrapper

* add history dep

* provide test data and mock react router

* add first confirmaion screen

* figure out a way to mock match.params

* render token approval with data

* fix lockfile

* fix lint

* remove use effect

* lintfix

* add . for src paths

* litfix

* Add knobs to change redux store for confirm-approve component (Storybook) ()

* add knob for domain

* knobify

* remove logs

* remove comment

* lintfix

* fix comments

* add background calls + metriccs event to storybook acctions

* lintfixxxx
2021-05-25 08:20:09 +08:00
Daniel
1a9206018a
Improve UI + content for price difference notifications () 2021-05-21 12:02:23 -05:00
Daniel
df6cb42594
Swaps: Create a new swap () 2021-05-21 10:14:56 -05:00
ryanml
6640973858
Fixing jest component test output errors ()
* Adding missing required props to component tests

* Removing unused IntroPopup component

* Mocking useLayoutEffect as useEffect in confirm-page-container-header.component.test.js
2021-05-20 11:28:25 -07:00
Alex Donesky
f19207ca87
use etherscan-link customBlockExplorer methods with customNetwork usage tracking ()
* use etherscan-link customBlockExplorer methods with customNetwork usage tracking

* consolidate blockexplorer events, add domain to metametrics event

* lint fix
2021-05-19 09:51:47 -05:00
Brad Decker
9386e3cb03
create safer isValidAddress method () 2021-05-17 14:00:59 -05:00
Daniel
85eb62e8cf
Swaps: Add specific error content if Contract data are not enabled on Ledger () 2021-05-13 14:49:00 -05:00
Daniel
a174e3b99a
Swaps: Add more anonymized tracking for HW wallet and HW wallet type () 2021-05-13 14:26:08 -05:00
Daniel
b4872b5fe2
Fix redirection to the build quotes page from the swaps failed page () 2021-05-10 14:48:37 -02:30
Daniel
002763222b
Swaps: Improve hardware wallet UX () 2021-05-06 09:14:42 -05:00
ryanml
687d0486b1
Allowing for scroll overflow when swaps content is too tall ()
Fixes 
2021-05-05 15:46:16 -07:00
Daniel
d7754f39bd
Allow 0% slippage, show a warning for 0 < slippage <= 1, disable "Review Swap" button for negative slippage ()
* Allow 0% slippage, show a warning for 0 < slippage <= 1, disable “Review Swap” button for negative slippage

* Update a translation key, use both new and old key until it’s translated everywhere

* Keep an old key for `en`: swapSlippageTooLow

* Fix an ESLint issue

* Only use swapSlippageNegative, remove swapSlippageTooLow
2021-05-05 14:47:38 -02:30
Daniel
d6d924b2b5
Add backwards compatibility for ETH <-> WETH contract address validation () 2021-04-30 13:48:56 -05:00
Brad Decker
09d81ac5f2
remove the ui/app and ui/lib folders () 2021-04-28 14:53:59 -05:00