* 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
* Updating account menu icon color
* Updating design-tokens and making appropriate updates to extension styles
* Adding more deprecated tags to colors
* Adding spinner and removing todo comment
* Remove comment
* Updates
* Updating snapshots
* More color and ui updates
* reverting transition change
* If there is no array of top assets in a response, use an empty array
* Set a default empty array for 2 functions, remove an unnecessary condition
* Redirect a user from Swaps to the homepage if they switch to a chain that is not supported in Swaps
* Fix errors in the UI Console when it's not a swaps chain
* 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
This PR changes over the deprecated knobs and actions in `fee-card.stories.js` to controls.
I attempted to create a `README.mdx`, but unfortunately the `<ArgsTable of={FeeCard} />` refused to render out any of the documentation comments I added to the `FeeCard.propTypes`, thus that has not been included (and no documentation has been added to the propTypes of FeeCard).
_Please note:_ currently nested arg types are not possible in StoryBook, but discussions are open: https://github.com/storybookjs/storybook/issues/11486. This means that the StoryBook shows `primaryFee`, `primaryMaxFee`, `secondaryFee` and `secondaryMaxFee`, but these are mapped to the 2 `primaryFee` and `secondaryFee` props of the component. This is visible if the developer clicks on the `Show code` button at the docs page in StoryBook.
Signed-off-by: Jurriaan Den Toonder <1493561+Fastjur@users.noreply.github.com>
- Don’t call /estimateGas if a user doesn’t have enough funds
- Hardcode block explorer URLs for Swaps
- Track the "stx_prev_user_opt_in" param
- Add fee estimates tracking for regular txs and STX
- Track estimated_gas and estimated_vs_used_gasRatio for STX
- Only track the "Error Smart Transactions" event once
- Don't overwrite "maxGasLimit" for STX on the View Quote page for better "balance needed" estimations
- Update description for Transak
- Fix styles for the input field on the Build Quote page
- Refactor variables for STX error types and add translation for each STX error type
- Do additional logging for the "current_stx_enabled" param
- Add a close icon for an STX notification, update STX content
* fix issue where we show contract address as recipient when calling safe transfer method on erc721 or erc1155 contracts
* updates function name getTransactionData -> parseStandardTokenTransactionData, and adds documentation
The `data-test-id` prop has been added to `TextField`. This prop allows
selecting this component more easily from e2e and unit tests. This is
required for a subsequent PR that includes a text field that cannot be
selected for by placeholder or contents or label (any of which would
have been preferable).
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>
* 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 (#13742)
* 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>
* 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
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.
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';
```
* 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
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.
* 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
* 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>
* 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
* 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>
* Add target object word to "View on Etherscan" links
Fix for: #9476
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>
* Update contract address validations in swaps for different networks
* Add support for direct contract swaps for wrapping and unwrapping
* Add WETH_RINKEBY_CONTRACT_ADDRESS
* 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]
* 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
* 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>
* 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
* 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
* 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) (#11135)
* add knob for domain
* knobify
* remove logs
* remove comment
* lintfix
* fix comments
* add background calls + metriccs event to storybook acctions
* lintfixxxx
* 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