Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor eth_sendTransaction handler #5619

Merged
merged 4 commits into from
Apr 5, 2023
Merged

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Jan 26, 2023

Development & PR Process

  1. Follow MetaMask Mobile Coding Standards
  2. Add release-xx label to identify the PR slated for a upcoming release (will be used in release discussion)
  3. Add needs-dev-review label when work is completed
  4. Add needs-qa label when dev review is completed
  5. Add QA Passed label when QA has signed off

Description

The handler for eth_sendTransaction was previously spread between RPCMethodMiddleware.ts and the static middleware of web3-provider-engine. Instead it is all handled in RPCMethodMiddleware.ts now.

This should have no functional impact. It is difficult to trace through web3-provider-engine, but this case is one of the easier ones because the static middleware is run first, and in this case it will always end the request.

Issue

This relates to #5513

Checklist

  • There is a related GitHub issue
  • Tests are included if applicable
  • Any added code is fully documented

@Gudahtt Gudahtt marked this pull request as ready for review January 26, 2023 21:38
@Gudahtt Gudahtt requested a review from a team as a code owner January 26, 2023 21:38
@Gudahtt Gudahtt added the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Jan 26, 2023
sethkfman
sethkfman previously approved these changes Jan 30, 2023
Copy link
Contributor

@sethkfman sethkfman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sethkfman
Copy link
Contributor

I think can be tested using the E2E Send Transaction test suite. @cortisiko @Gudahtt

@Gudahtt Gudahtt force-pushed the refactor-send-transaction-handler branch from 1500463 to 241ba4e Compare March 8, 2023 02:43
@Gudahtt Gudahtt marked this pull request as draft March 8, 2023 03:08
Gudahtt added a commit that referenced this pull request Mar 15, 2023
The method handler for `eth_sendTransaction` has been moved to a
separate module to simplify unit testing. Unit tests have been added
as well.

This module was written in TypeScript, which asked for some additional
validation of the method parameters. We now throw a more explicit
message when the params are missing, and when the transaction
parameters are not an object. Previously the method would still throw
an error in these scenarios, just with a less helpful message. The
change in error message should be the only functional change here.

This refactor is intended to make testing PR #5619 easier.
Gudahtt added a commit that referenced this pull request Mar 15, 2023
The method handler for `eth_sendTransaction` has been moved to a
separate module to simplify unit testing. Unit tests have been added
as well.

This module was written in TypeScript, which asked for some additional
validation of the method parameters. We now throw a more explicit
message when the params are missing, and when the transaction
parameters are not an object. Previously the method would still throw
an error in these scenarios, just with a less helpful message. The
change in error message should be the only functional change here.

This refactor is intended to make testing PR #5619 easier.
Gudahtt added a commit that referenced this pull request Mar 15, 2023
The method handler for `eth_sendTransaction` has been moved to a
separate module to simplify unit testing. Unit tests have been added
as well.

This module was written in TypeScript, which asked for some additional
validation of the method parameters. We now throw a more explicit
message when the params are missing, and when the transaction
parameters are not an object. Previously the method would still throw
an error in these scenarios, just with a less helpful message. The
change in error message should be the only functional change here.

This refactor is intended to make testing PR #5619 easier.
@Gudahtt Gudahtt marked this pull request as ready for review March 15, 2023 22:40
@Gudahtt

This comment was marked as resolved.

Gudahtt added a commit that referenced this pull request Mar 15, 2023
* Refactor `eth_sendTransaction` method handler

The method handler for `eth_sendTransaction` has been moved to a
separate module to simplify unit testing. Unit tests have been added
as well.

This module was written in TypeScript, which asked for some additional
validation of the method parameters. We now throw a more explicit
message when the params are missing, and when the transaction
parameters are not an object. Previously the method would still throw
an error in these scenarios, just with a less helpful message. The
change in error message should be the only functional change here.

This refactor is intended to make testing PR #5619 easier.

* Support `.cjs` file extensions

The Metro configuration has been updated to support `.cjs` file
extensions. The `@metamask/utils` dependency relies upon the library
`superstruct` which uses `.cjs` for its main exported module.
@Gudahtt Gudahtt force-pushed the refactor-send-transaction-handler branch from 241ba4e to a10f602 Compare March 16, 2023 01:37
@Gudahtt Gudahtt force-pushed the refactor-send-transaction-handler branch from a10f602 to 94e092d Compare March 16, 2023 01:40
@Gudahtt
Copy link
Member Author

Gudahtt commented Mar 16, 2023

Tests have been added for the eth_sendTransaction method handler, as well as for the validation happening in RPCMethodMiddleware.

I was going to scrap the RPCMethodMiddleware tests, but I had them so close to working already that I figured I may as well finish them. There is a lot of important validation happening there. Long-term it would be better to extract shared validation steps to a separate middleware function, but that would have to be done very carefully. For now, it seemed easiest to test them in-place, despite the complexity. Hopefully the comments adequately explain each of the setup steps; please ask if anything is unclear.

@Gudahtt Gudahtt dismissed sethkfman’s stale review March 16, 2023 01:46

Substantial additional changes have been made

SamuelSalas pushed a commit that referenced this pull request Mar 22, 2023
* Refactor `eth_sendTransaction` method handler

The method handler for `eth_sendTransaction` has been moved to a
separate module to simplify unit testing. Unit tests have been added
as well.

This module was written in TypeScript, which asked for some additional
validation of the method parameters. We now throw a more explicit
message when the params are missing, and when the transaction
parameters are not an object. Previously the method would still throw
an error in these scenarios, just with a less helpful message. The
change in error message should be the only functional change here.

This refactor is intended to make testing PR #5619 easier.

* Support `.cjs` file extensions

The Metro configuration has been updated to support `.cjs` file
extensions. The `@metamask/utils` dependency relies upon the library
`superstruct` which uses `.cjs` for its main exported module.
Cal-L added a commit that referenced this pull request Mar 24, 2023
* Upgrade on-ramp-sdk to 1.9.0 (#5782)

* Update 6.1.2 changelog (#5953)

Update change log formatting and language

* E2E Establish performance baseline (#5947)

* set baseline time

* fix step to dismiss keyboard and add console.log to spit out launch time to console.

* add tags, create performance folder.

* remove scenario chaining

* change launch times

* Verify Contract Details (#5327)

* draft_token_allowance

* code cleanup

* fetch token address, nickname and image

* rebased to main

* styles should match design

* toggle blockexplorer state, token image

* validate address before saving

* token symbols

* implement feedback

* updated snapshot

* rebased to main

* remove unused code

* code cleanup

* code rebase and clean

* snapshot update

* test_address rewrite

* rebased to main

* rebased to main, QA issue fix

* QA issues fix

* fix QA issues

* update snapshot

* rebased to main

* updated to use the new network controller update

* remove unneccessary fallbacks

* INFRA-837: Add sonar integration (#5949)

* INFRA-837: Add sonar integration

* Update sonar branch

* Vault corruption recovery flow (#4421)

* Handle Vault Corruption
- trigger vault recovery flow in Login when error occurs
- fetch backup from vault and then reinitialize the engine with the
  backed up keyring
- we also destroy the old engine
- some local data might be lost but the accounts will be safe
- on fail we get them to create/import a new wallet
-  translations

* switch to nativeevent (#5960)

* Added translations for MC 0.5 (#5964)

* [FIX] Remove select address as a prop on App index.js (#5962)

* Remove select address as a prop on App index.js

* Update snapshot

* Bump @xmldom/xmldom from 0.8.3 to 0.8.6 (#5959)

Bumps [@xmldom/xmldom](https://github.com/xmldom/xmldom) from 0.8.3 to 0.8.6.
- [Release notes](https://github.com/xmldom/xmldom/releases)
- [Changelog](https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md)
- [Commits](xmldom/xmldom@0.8.3...0.8.6)

---
updated-dependencies:
- dependency-name: "@xmldom/xmldom"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump http-cache-semantics from 4.1.0 to 4.1.1 (#5669)

Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](kornelski/http-cache-semantics@v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Extract test accounts to env vars (#5952)

* make detox import SRP from accounts.js file.
* extract account infos to env vars
* update e2e instructions and add vars in .js.env template

---------

Co-authored-by: Curtis <Curtis.David7@gmail.com>

* improv: add workflow triggers for tags on release and QA (#5902)

update notifications

* [UPDATE] pin sonar action to commit (#5967)

* pin the sonar action to a specific commit

* format sonar file

* remove extra line from file

* [UPDATE] sonar action configuration (#5972)

* pin the sonar action to a specific commit

* format sonar file

* remove extra line from file

* bump the sonar checkout action version which will use compliant version of node

* configure sonar analysis directors, test path, exclusions

* added project & file configurations

* remove test directory argument and added more exclusions

* added more exclusions

* added test inclusions and root directory for tests

* Move `eth_sendTransaction` method handler to a separate module (#5968)

* Refactor `eth_sendTransaction` method handler

The method handler for `eth_sendTransaction` has been moved to a
separate module to simplify unit testing. Unit tests have been added
as well.

This module was written in TypeScript, which asked for some additional
validation of the method parameters. We now throw a more explicit
message when the params are missing, and when the transaction
parameters are not an object. Previously the method would still throw
an error in these scenarios, just with a less helpful message. The
change in error message should be the only functional change here.

This refactor is intended to make testing PR #5619 easier.

* Support `.cjs` file extensions

The Metro configuration has been updated to support `.cjs` file
extensions. The `@metamask/utils` dependency relies upon the library
`superstruct` which uses `.cjs` for its main exported module.

* fix: bundle video in app to prevent crash when not available (2nd attempt) (#5941)

- bundle video with embedded the subtitles in app
- add a readme in video folder to explain risks if video and subs files are moved or removed
- add a shell script running ffmpeg to regenerate the video
- remove useless constants and code related to remote SRP video resources.

* Send to multisig address. (#5931)

* Send to multisig address.

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

* Linter fix.

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

* Revert wdio changes

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

---------

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

* fixed iyarc format removed exclusions not needed, added exclusion for production value since the project is stilll maintained (#5978)

* [IMPLEMENT] Use Terms Modal (#5242)

* user terms modal builded

* use terms modal logic implemented

* small fix on translations

* remove old terms and conditions

* remove ts ignore

* fix typo

* create a MandatoryModal component

* readme and update props to generic names

* update snapshot

* changing && to ternary operator for a more accurate ui rendering

* added margin and added component to the storybook

* implemented webview to show the ToU

* scale font size

* clean

* fix snapshot

* fix lint

* analytics

* modal mandatory more agnostic

* Clean up styles and storybook

* Clean up on accept logic

* logic on util file termsOfUse

* scrolling webview on Android and reusable modal not dismissable

* Implemented option scroll needed on ModalMandatory

* update source of use terms

* fix import

* remove margin bottom

* english translation updated

* fix button import

* modal mandatory not dismissable

* change icon name

* use terms modal on android for existing users

* ToU called only called on nav/app component

* Revert "ToU called only called on nav/app component"

This reverts commit 7f2e12f.

* fix redirect on ToU modal to acessibility website

* fix track ecent

* E2e appium/5783 tou onboarding new app installs (#5951)

* Webdriverio and Detox test scripts for Term of use feature. Test scripts updated to have the term of use steps

* Small changes to fit browserstack

* Remove static-logos.js file changes

* move terms of use to before importing or create a new allet

* Update Detox and wdio test scripts to be compatible with the recept term of use changes

* Solve lint issues

---------

Co-authored-by: Cal Leung <cleun007@gmail.com>
Co-authored-by: SamuelSalas <samuel.salas.reyes@gmail.com>

* feat: add portfolio button to asset action buttons (#5785)

* feat: add portfolio button to asset action buttons

* Update app/components/UI/AccountOverview/index.js

Co-authored-by: Cal Leung <cleun007@gmail.com>

* chore: move portfolio url to AppConstants

* chore: fix minor issues

* chore: add event for portfolio link clicked

* chore: add snapshot test update

* chore: add translations

* add new icon type name

* chore: move portfolio button next to net worth

* chore: add progress

* fix: tab not updating properly

* move styles to stylesheet

* fix wallet index test

* remove logs and actually fix wallet index test

* re-open existing tab instead of new tab after browser is loaded

* fix browser load, active tab not re-appearing bug

---------

Co-authored-by: Cal Leung <cleun007@gmail.com>

* dispaly nft info in browser (#5930)

* Clear Hex data when Token Transfer reverts ETH (#5839)

* clear hexdata when token updates to eth

* native token transaction data set to 0x

* use constants

* Ignore e2e test artifacts (#5998)

A `.gitignore` entry has been added for the `artifacts` directory that
gets generated locally when a Detox iOS e2e test fails.

* remove sonar config from actions that can be configured in the web portal (#6013)

* [ENHANCEMENT] E2E Permission system tests (#5910)

* detox permission system working.

* fix lint

* removing imported account steps.

* update steps in feature files.

* added constants for element locators and added new feature file

* fix linting

* update tests

* fix linting

* update test name

* delete wallet on permission system flow. need to set better timeouts to deal with toast

* remove redudant test steps.

* set baseline time

* fix step to dismiss keyboard and add console.log to spit out launch time to console.

* fix browser path

* update dapp

* fix tests from merge conflict.

* add long wait to terms of use modal to deal with flakiness on bitrise

* remove redundant test

* disabling the ToU test.

* Fix 18 JS type errors for TSC to output 683 TS/TSX errors (#5975)

* Fix 18 JS type errors exposing 683 TS/TSX errors

Minimum required to tackle remaining errors in 120 files

Follow-up to: #5879

Fix: #5878

Next: #5882

* Fix app/core/Engine.ts lint errors

* Revert "Fix app/core/Engine.ts lint errors"

This reverts commit 7ac7011.

* Fix app/core/Engine.ts lint errors

* Skip type checking library declaration files (#5882)

Fix: #5881

* [FEATURE] SDK Session Persistence (#5948)

* refactor: sdkconnect typescript rewrite and otp generation

* feat: permission management with otp deeplinks

* feat: modal ui for loading / feedback on sdk connection state

* feat: remove sdk settings from experimental

* feat: prevent empty title in transaction header

* feat: add otp in account approval modal

* feat: i18n on sdk feedback modal

* chore: cleanup comments

* chore: remove rememberme comments

* feat: use default codefi server url

* fix: missing otp actions

* chore: remove sdk from experiment description

* feat: mmsdk auto retrieve approved account on getProviderState

* chore: simplify logic for easier code readability

* feat: manage sdk backward compatibility

* feat: auto validate permission on deeplink reconnection

* fix: typo

* fix: useeffect deps

* feat: new styling of otp

* chore: remove comments

* feat: remove unnecessary view

* feat: remove unnecessary view

* chore: linting and typos

* chore: more linting adjustments

* fix: invalid json file

* fix: update jest snapshot for accountoverview

* chore: remove extra space

* feat: remove plaintext option used to debug protocol

* chore: remove unused text

* feat: move modal from drawer to root navigation

* feat: edit i18n values and remove unused text

* chore: remove console logs

* feat: use theme typography in createstyle

* feat: use navigation instead of redux store to display loading state

* feat: update snapshot after ui changes

* chore: remove unused code + linting

* fix: invalid typography

* fix: rename for valid camelcase

* chore: cleanup

* chore: remove unused code

* feat: consolidate action params within connect uri

* feat: add do not remember channel option

* feat: use useAssetFromTheme hook for loading modal

* fix: linting

* chore: remove console logs

* feat: remove sdk modal references

* feat: extract onconfirm action to component props

* fix: prevent opening inappbrowser on connect deeplink

* feat: update ui according to latest design file

* feat: prevent invalid connection interruption when paused

* feat: display sorted connection list

* feat: send metamask wallet version to connected clients

* feat: replace fontstyles with typography in account approval modal

* chore: consolidate sdk constants to AppConstants

* chore: formatting

* fix: duplicated imports

* build: update communication layer dep to 0.2.0

* chore: disable debug logs

* chore: prevent linting error

* chore: remove comm layer

* chore: linting

* feat: replace navigation.goback with sheetRef.hide

* feat: remove fontSize when using typography

* feat: use Icon library instead of fontawesome

* feat: catchall title value

* feat: catchall title value

* Revert "Move `eth_sendTransaction` method handler to a separate module (#5968)" (#6021)

This reverts commit 49a6305.

* On-ramp: Add accessibility label to custom action images (#6016)

* disable back press and add margin to the bottom for accept ToU modal (#6023)

* On-ramp: Add #6009 strings (#6019)

* [FEATURE] Account selector on swaps screen (#5997)

* Account selector on swaps screen

* remove unused import

* update with comment and without justify content

* update with previous selected address

* add ellipsis to the account name if it is more than 13 chars

* feat: add consensys zkevm (Linea) support (#5958)

* feat: add consensys zkevm support

* fix: change consensys zkevm network name to Linea + change rpc url

* feat: add feature toggle for linea network

* feat: add two utility functions for block explorer url

* feat: add patches to support lineatestnet

* fix: add linea testnet as rpc network

* fix: updates imports

* Fix merge conflicts from merging main

* Fix trackEvents

* Fix missing import

* Fix for #5898 - Converting native ETH to fiat and fiat to native ETH results in wrong values beign displayed on the Amount screen (#5961)

* use setState callback to call onInputChange

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

* E2E for currency switch

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

* Lint fix

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

* Update snapshot

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

---------

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

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com>
Co-authored-by: Pedro Pablo Aste Kompen <wachunei@gmail.com>
Co-authored-by: sethkfman <10342624+sethkfman@users.noreply.github.com>
Co-authored-by: Curtis David <Curtis.David7@gmail.com>
Co-authored-by: Sylva Elendu <iamsylvaelendu@gmail.com>
Co-authored-by: José Manuel <6741785+jluque0101@users.noreply.github.com>
Co-authored-by: Owen Craston <owen.craston@consensys.net>
Co-authored-by: witmicko <witmicko@users.noreply.github.com>
Co-authored-by: tommasini <46944231+tommasini@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nicolas MASSART <NicolasMassart@users.noreply.github.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Olusegun Akintayo <trinisoftinc@gmail.com>
Co-authored-by: SamuelSalas <samuel.salas.reyes@gmail.com>
Co-authored-by: Matthew Epps <mepps32@gmail.com>
Co-authored-by: LeoTM <1881059+leotm@users.noreply.github.com>
Co-authored-by: abretonc7s <107169956+abretonc7s@users.noreply.github.com>
Co-authored-by: Victorien Gauch <85494462+VGau@users.noreply.github.com>
Cal-L added a commit that referenced this pull request Mar 24, 2023
* Upgrade on-ramp-sdk to 1.9.0 (#5782)

* Update 6.1.2 changelog (#5953)

Update change log formatting and language

* E2E Establish performance baseline (#5947)

* set baseline time

* fix step to dismiss keyboard and add console.log to spit out launch time to console.

* add tags, create performance folder.

* remove scenario chaining

* change launch times

* Verify Contract Details (#5327)

* draft_token_allowance

* code cleanup

* fetch token address, nickname and image

* rebased to main

* styles should match design

* toggle blockexplorer state, token image

* validate address before saving

* token symbols

* implement feedback

* updated snapshot

* rebased to main

* remove unused code

* code cleanup

* code rebase and clean

* snapshot update

* test_address rewrite

* rebased to main

* rebased to main, QA issue fix

* QA issues fix

* fix QA issues

* update snapshot

* rebased to main

* updated to use the new network controller update

* remove unneccessary fallbacks

* INFRA-837: Add sonar integration (#5949)

* INFRA-837: Add sonar integration

* Update sonar branch

* Vault corruption recovery flow (#4421)

* Handle Vault Corruption
- trigger vault recovery flow in Login when error occurs
- fetch backup from vault and then reinitialize the engine with the
  backed up keyring
- we also destroy the old engine
- some local data might be lost but the accounts will be safe
- on fail we get them to create/import a new wallet
-  translations

* switch to nativeevent (#5960)

* Added translations for MC 0.5 (#5964)

* [FIX] Remove select address as a prop on App index.js (#5962)

* Remove select address as a prop on App index.js

* Update snapshot

* Bump @xmldom/xmldom from 0.8.3 to 0.8.6 (#5959)

Bumps [@xmldom/xmldom](https://github.com/xmldom/xmldom) from 0.8.3 to 0.8.6.
- [Release notes](https://github.com/xmldom/xmldom/releases)
- [Changelog](https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md)
- [Commits](xmldom/xmldom@0.8.3...0.8.6)

---
updated-dependencies:
- dependency-name: "@xmldom/xmldom"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump http-cache-semantics from 4.1.0 to 4.1.1 (#5669)

Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](kornelski/http-cache-semantics@v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Extract test accounts to env vars (#5952)

* make detox import SRP from accounts.js file.
* extract account infos to env vars
* update e2e instructions and add vars in .js.env template

---------

Co-authored-by: Curtis <Curtis.David7@gmail.com>

* improv: add workflow triggers for tags on release and QA (#5902)

update notifications

* [UPDATE] pin sonar action to commit (#5967)

* pin the sonar action to a specific commit

* format sonar file

* remove extra line from file

* [UPDATE] sonar action configuration (#5972)

* pin the sonar action to a specific commit

* format sonar file

* remove extra line from file

* bump the sonar checkout action version which will use compliant version of node

* configure sonar analysis directors, test path, exclusions

* added project & file configurations

* remove test directory argument and added more exclusions

* added more exclusions

* added test inclusions and root directory for tests

* Move `eth_sendTransaction` method handler to a separate module (#5968)

* Refactor `eth_sendTransaction` method handler

The method handler for `eth_sendTransaction` has been moved to a
separate module to simplify unit testing. Unit tests have been added
as well.

This module was written in TypeScript, which asked for some additional
validation of the method parameters. We now throw a more explicit
message when the params are missing, and when the transaction
parameters are not an object. Previously the method would still throw
an error in these scenarios, just with a less helpful message. The
change in error message should be the only functional change here.

This refactor is intended to make testing PR #5619 easier.

* Support `.cjs` file extensions

The Metro configuration has been updated to support `.cjs` file
extensions. The `@metamask/utils` dependency relies upon the library
`superstruct` which uses `.cjs` for its main exported module.

* fix: bundle video in app to prevent crash when not available (2nd attempt) (#5941)

- bundle video with embedded the subtitles in app
- add a readme in video folder to explain risks if video and subs files are moved or removed
- add a shell script running ffmpeg to regenerate the video
- remove useless constants and code related to remote SRP video resources.

* Send to multisig address. (#5931)

* Send to multisig address.

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

* Linter fix.

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

* Revert wdio changes

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

---------

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

* fixed iyarc format removed exclusions not needed, added exclusion for production value since the project is stilll maintained (#5978)

* [IMPLEMENT] Use Terms Modal (#5242)

* user terms modal builded

* use terms modal logic implemented

* small fix on translations

* remove old terms and conditions

* remove ts ignore

* fix typo

* create a MandatoryModal component

* readme and update props to generic names

* update snapshot

* changing && to ternary operator for a more accurate ui rendering

* added margin and added component to the storybook

* implemented webview to show the ToU

* scale font size

* clean

* fix snapshot

* fix lint

* analytics

* modal mandatory more agnostic

* Clean up styles and storybook

* Clean up on accept logic

* logic on util file termsOfUse

* scrolling webview on Android and reusable modal not dismissable

* Implemented option scroll needed on ModalMandatory

* update source of use terms

* fix import

* remove margin bottom

* english translation updated

* fix button import

* modal mandatory not dismissable

* change icon name

* use terms modal on android for existing users

* ToU called only called on nav/app component

* Revert "ToU called only called on nav/app component"

This reverts commit 7f2e12f.

* fix redirect on ToU modal to acessibility website

* fix track ecent

* E2e appium/5783 tou onboarding new app installs (#5951)

* Webdriverio and Detox test scripts for Term of use feature. Test scripts updated to have the term of use steps

* Small changes to fit browserstack

* Remove static-logos.js file changes

* move terms of use to before importing or create a new allet

* Update Detox and wdio test scripts to be compatible with the recept term of use changes

* Solve lint issues

---------

Co-authored-by: Cal Leung <cleun007@gmail.com>
Co-authored-by: SamuelSalas <samuel.salas.reyes@gmail.com>

* feat: add portfolio button to asset action buttons (#5785)

* feat: add portfolio button to asset action buttons

* Update app/components/UI/AccountOverview/index.js

Co-authored-by: Cal Leung <cleun007@gmail.com>

* chore: move portfolio url to AppConstants

* chore: fix minor issues

* chore: add event for portfolio link clicked

* chore: add snapshot test update

* chore: add translations

* add new icon type name

* chore: move portfolio button next to net worth

* chore: add progress

* fix: tab not updating properly

* move styles to stylesheet

* fix wallet index test

* remove logs and actually fix wallet index test

* re-open existing tab instead of new tab after browser is loaded

* fix browser load, active tab not re-appearing bug

---------

Co-authored-by: Cal Leung <cleun007@gmail.com>

* dispaly nft info in browser (#5930)

* Clear Hex data when Token Transfer reverts ETH (#5839)

* clear hexdata when token updates to eth

* native token transaction data set to 0x

* use constants

* Ignore e2e test artifacts (#5998)

A `.gitignore` entry has been added for the `artifacts` directory that
gets generated locally when a Detox iOS e2e test fails.

* remove sonar config from actions that can be configured in the web portal (#6013)

* [ENHANCEMENT] E2E Permission system tests (#5910)

* detox permission system working.

* fix lint

* removing imported account steps.

* update steps in feature files.

* added constants for element locators and added new feature file

* fix linting

* update tests

* fix linting

* update test name

* delete wallet on permission system flow. need to set better timeouts to deal with toast

* remove redudant test steps.

* set baseline time

* fix step to dismiss keyboard and add console.log to spit out launch time to console.

* fix browser path

* update dapp

* fix tests from merge conflict.

* add long wait to terms of use modal to deal with flakiness on bitrise

* remove redundant test

* disabling the ToU test.

* Fix 18 JS type errors for TSC to output 683 TS/TSX errors (#5975)

* Fix 18 JS type errors exposing 683 TS/TSX errors

Minimum required to tackle remaining errors in 120 files

Follow-up to: #5879

Fix: #5878

Next: #5882

* Fix app/core/Engine.ts lint errors

* Revert "Fix app/core/Engine.ts lint errors"

This reverts commit 7ac7011.

* Fix app/core/Engine.ts lint errors

* Skip type checking library declaration files (#5882)

Fix: #5881

* [FEATURE] SDK Session Persistence (#5948)

* refactor: sdkconnect typescript rewrite and otp generation

* feat: permission management with otp deeplinks

* feat: modal ui for loading / feedback on sdk connection state

* feat: remove sdk settings from experimental

* feat: prevent empty title in transaction header

* feat: add otp in account approval modal

* feat: i18n on sdk feedback modal

* chore: cleanup comments

* chore: remove rememberme comments

* feat: use default codefi server url

* fix: missing otp actions

* chore: remove sdk from experiment description

* feat: mmsdk auto retrieve approved account on getProviderState

* chore: simplify logic for easier code readability

* feat: manage sdk backward compatibility

* feat: auto validate permission on deeplink reconnection

* fix: typo

* fix: useeffect deps

* feat: new styling of otp

* chore: remove comments

* feat: remove unnecessary view

* feat: remove unnecessary view

* chore: linting and typos

* chore: more linting adjustments

* fix: invalid json file

* fix: update jest snapshot for accountoverview

* chore: remove extra space

* feat: remove plaintext option used to debug protocol

* chore: remove unused text

* feat: move modal from drawer to root navigation

* feat: edit i18n values and remove unused text

* chore: remove console logs

* feat: use theme typography in createstyle

* feat: use navigation instead of redux store to display loading state

* feat: update snapshot after ui changes

* chore: remove unused code + linting

* fix: invalid typography

* fix: rename for valid camelcase

* chore: cleanup

* chore: remove unused code

* feat: consolidate action params within connect uri

* feat: add do not remember channel option

* feat: use useAssetFromTheme hook for loading modal

* fix: linting

* chore: remove console logs

* feat: remove sdk modal references

* feat: extract onconfirm action to component props

* fix: prevent opening inappbrowser on connect deeplink

* feat: update ui according to latest design file

* feat: prevent invalid connection interruption when paused

* feat: display sorted connection list

* feat: send metamask wallet version to connected clients

* feat: replace fontstyles with typography in account approval modal

* chore: consolidate sdk constants to AppConstants

* chore: formatting

* fix: duplicated imports

* build: update communication layer dep to 0.2.0

* chore: disable debug logs

* chore: prevent linting error

* chore: remove comm layer

* chore: linting

* feat: replace navigation.goback with sheetRef.hide

* feat: remove fontSize when using typography

* feat: use Icon library instead of fontawesome

* feat: catchall title value

* feat: catchall title value

* Revert "Move `eth_sendTransaction` method handler to a separate module (#5968)" (#6021)

This reverts commit 49a6305.

* On-ramp: Add accessibility label to custom action images (#6016)

* disable back press and add margin to the bottom for accept ToU modal (#6023)

* On-ramp: Add #6009 strings (#6019)

* [FEATURE] Account selector on swaps screen (#5997)

* Account selector on swaps screen

* remove unused import

* update with comment and without justify content

* update with previous selected address

* add ellipsis to the account name if it is more than 13 chars

* feat: add consensys zkevm (Linea) support (#5958)

* feat: add consensys zkevm support

* fix: change consensys zkevm network name to Linea + change rpc url

* feat: add feature toggle for linea network

* feat: add two utility functions for block explorer url

* feat: add patches to support lineatestnet

* fix: add linea testnet as rpc network

* fix: updates imports

* Fix for #5898 - Converting native ETH to fiat and fiat to native ETH results in wrong values beign displayed on the Amount screen (#5961)

* use setState callback to call onInputChange

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

* E2E for currency switch

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

* Lint fix

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

* Update snapshot

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

---------

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

* Fix analytics

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com>
Co-authored-by: Pedro Pablo Aste Kompen <wachunei@gmail.com>
Co-authored-by: sethkfman <10342624+sethkfman@users.noreply.github.com>
Co-authored-by: Curtis David <Curtis.David7@gmail.com>
Co-authored-by: Sylva Elendu <iamsylvaelendu@gmail.com>
Co-authored-by: José Manuel <6741785+jluque0101@users.noreply.github.com>
Co-authored-by: Owen Craston <owen.craston@consensys.net>
Co-authored-by: witmicko <witmicko@users.noreply.github.com>
Co-authored-by: tommasini <46944231+tommasini@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nicolas MASSART <NicolasMassart@users.noreply.github.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Olusegun Akintayo <trinisoftinc@gmail.com>
Co-authored-by: SamuelSalas <samuel.salas.reyes@gmail.com>
Co-authored-by: Matthew Epps <mepps32@gmail.com>
Co-authored-by: LeoTM <1881059+leotm@users.noreply.github.com>
Co-authored-by: abretonc7s <107169956+abretonc7s@users.noreply.github.com>
Co-authored-by: Victorien Gauch <85494462+VGau@users.noreply.github.com>
sethkfman added a commit that referenced this pull request Mar 24, 2023
* 6.2.0

* Upgrade on-ramp-sdk to 1.9.0 (#5782) (#5943)

Co-authored-by: Pedro Pablo Aste Kompen <wachunei@gmail.com>

* [FIX] Prevent account selection reset (#5966)

* Remove select address as a prop on App index.js

* Update snapshot

* Fix wallet creation (#5971)

revert function back to logic from #5374

* [UPDATE] yarn audit config and providing excluded reasoning (#5987)

* updated yarn audit config and providing excluded reasoning

* fix lint warnings remove unused import

* Revert Relative Path for EditGas (#5973)

* update relative path for edit gas

* update relative path for editgas legacy

* On-ramp: Add #5870 localization (#5976)

* Add #5870 localization strings

* Center and lowercase text

* [UPDATE] - patch for request 2.88.2 yarn audit (#5988)

* updated yarn audit config and providing excluded reasoning

* fix lint warnings remove unused import

* add a patch for yarn audit report on request

* [FIX] Fix displaying balance on watch asset screen (#5970)

* Fix displaying balance on watch asset screen

* Fallback to use wallet account if no account is connected to Dapp for watch asset

* Fix linting issues

* [FIX] Fix SRP reveal screen (#5980)

* Fix padding issues on ErrorBoundary

* Provide navigation to ErrorBoundary

* Clean up RevealPrivateCredential screen

* Fix safe area view on ErrorBoundary

* Fix linting issues

* [REVERT] Revert Segment related changes for 6.2.0 (#5991)

* Revert "[IMPROVEMENT] Analytics Alert (#5892)"

This reverts commit 6eddb15.

* Revert "[FIX] Initial Analytics Opt Out (#5863)"

This reverts commit 1474d44.

* Revert "[ANALYTICS] Events migration (#5139)"

This reverts commit e3d8124.

* Fix redundant URL import

* [UPDATE] changelog and bump app version for RC2 (#6005)

* update changelog and bump app version for RC2

* removed merge conflict

* undo delete of alert

* [MERGE] Merge main into 6.2.0 (#6029)

* Fix merge conflicts from merging main

* Fix trackEvents

* Fix missing import

* [Merge] Fix merge conflicts with main (#6031)

* Upgrade on-ramp-sdk to 1.9.0 (#5782)

* Update 6.1.2 changelog (#5953)

Update change log formatting and language

* E2E Establish performance baseline (#5947)

* set baseline time

* fix step to dismiss keyboard and add console.log to spit out launch time to console.

* add tags, create performance folder.

* remove scenario chaining

* change launch times

* Verify Contract Details (#5327)

* draft_token_allowance

* code cleanup

* fetch token address, nickname and image

* rebased to main

* styles should match design

* toggle blockexplorer state, token image

* validate address before saving

* token symbols

* implement feedback

* updated snapshot

* rebased to main

* remove unused code

* code cleanup

* code rebase and clean

* snapshot update

* test_address rewrite

* rebased to main

* rebased to main, QA issue fix

* QA issues fix

* fix QA issues

* update snapshot

* rebased to main

* updated to use the new network controller update

* remove unneccessary fallbacks

* INFRA-837: Add sonar integration (#5949)

* INFRA-837: Add sonar integration

* Update sonar branch

* Vault corruption recovery flow (#4421)

* Handle Vault Corruption
- trigger vault recovery flow in Login when error occurs
- fetch backup from vault and then reinitialize the engine with the
  backed up keyring
- we also destroy the old engine
- some local data might be lost but the accounts will be safe
- on fail we get them to create/import a new wallet
-  translations

* switch to nativeevent (#5960)

* Added translations for MC 0.5 (#5964)

* [FIX] Remove select address as a prop on App index.js (#5962)

* Remove select address as a prop on App index.js

* Update snapshot

* Bump @xmldom/xmldom from 0.8.3 to 0.8.6 (#5959)

Bumps [@xmldom/xmldom](https://github.com/xmldom/xmldom) from 0.8.3 to 0.8.6.
- [Release notes](https://github.com/xmldom/xmldom/releases)
- [Changelog](https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md)
- [Commits](xmldom/xmldom@0.8.3...0.8.6)

---
updated-dependencies:
- dependency-name: "@xmldom/xmldom"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump http-cache-semantics from 4.1.0 to 4.1.1 (#5669)

Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](kornelski/http-cache-semantics@v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Extract test accounts to env vars (#5952)

* make detox import SRP from accounts.js file.
* extract account infos to env vars
* update e2e instructions and add vars in .js.env template

---------

Co-authored-by: Curtis <Curtis.David7@gmail.com>

* improv: add workflow triggers for tags on release and QA (#5902)

update notifications

* [UPDATE] pin sonar action to commit (#5967)

* pin the sonar action to a specific commit

* format sonar file

* remove extra line from file

* [UPDATE] sonar action configuration (#5972)

* pin the sonar action to a specific commit

* format sonar file

* remove extra line from file

* bump the sonar checkout action version which will use compliant version of node

* configure sonar analysis directors, test path, exclusions

* added project & file configurations

* remove test directory argument and added more exclusions

* added more exclusions

* added test inclusions and root directory for tests

* Move `eth_sendTransaction` method handler to a separate module (#5968)

* Refactor `eth_sendTransaction` method handler

The method handler for `eth_sendTransaction` has been moved to a
separate module to simplify unit testing. Unit tests have been added
as well.

This module was written in TypeScript, which asked for some additional
validation of the method parameters. We now throw a more explicit
message when the params are missing, and when the transaction
parameters are not an object. Previously the method would still throw
an error in these scenarios, just with a less helpful message. The
change in error message should be the only functional change here.

This refactor is intended to make testing PR #5619 easier.

* Support `.cjs` file extensions

The Metro configuration has been updated to support `.cjs` file
extensions. The `@metamask/utils` dependency relies upon the library
`superstruct` which uses `.cjs` for its main exported module.

* fix: bundle video in app to prevent crash when not available (2nd attempt) (#5941)

- bundle video with embedded the subtitles in app
- add a readme in video folder to explain risks if video and subs files are moved or removed
- add a shell script running ffmpeg to regenerate the video
- remove useless constants and code related to remote SRP video resources.

* Send to multisig address. (#5931)

* Send to multisig address.

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

* Linter fix.

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

* Revert wdio changes

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

---------

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

* fixed iyarc format removed exclusions not needed, added exclusion for production value since the project is stilll maintained (#5978)

* [IMPLEMENT] Use Terms Modal (#5242)

* user terms modal builded

* use terms modal logic implemented

* small fix on translations

* remove old terms and conditions

* remove ts ignore

* fix typo

* create a MandatoryModal component

* readme and update props to generic names

* update snapshot

* changing && to ternary operator for a more accurate ui rendering

* added margin and added component to the storybook

* implemented webview to show the ToU

* scale font size

* clean

* fix snapshot

* fix lint

* analytics

* modal mandatory more agnostic

* Clean up styles and storybook

* Clean up on accept logic

* logic on util file termsOfUse

* scrolling webview on Android and reusable modal not dismissable

* Implemented option scroll needed on ModalMandatory

* update source of use terms

* fix import

* remove margin bottom

* english translation updated

* fix button import

* modal mandatory not dismissable

* change icon name

* use terms modal on android for existing users

* ToU called only called on nav/app component

* Revert "ToU called only called on nav/app component"

This reverts commit 7f2e12f.

* fix redirect on ToU modal to acessibility website

* fix track ecent

* E2e appium/5783 tou onboarding new app installs (#5951)

* Webdriverio and Detox test scripts for Term of use feature. Test scripts updated to have the term of use steps

* Small changes to fit browserstack

* Remove static-logos.js file changes

* move terms of use to before importing or create a new allet

* Update Detox and wdio test scripts to be compatible with the recept term of use changes

* Solve lint issues

---------

Co-authored-by: Cal Leung <cleun007@gmail.com>
Co-authored-by: SamuelSalas <samuel.salas.reyes@gmail.com>

* feat: add portfolio button to asset action buttons (#5785)

* feat: add portfolio button to asset action buttons

* Update app/components/UI/AccountOverview/index.js

Co-authored-by: Cal Leung <cleun007@gmail.com>

* chore: move portfolio url to AppConstants

* chore: fix minor issues

* chore: add event for portfolio link clicked

* chore: add snapshot test update

* chore: add translations

* add new icon type name

* chore: move portfolio button next to net worth

* chore: add progress

* fix: tab not updating properly

* move styles to stylesheet

* fix wallet index test

* remove logs and actually fix wallet index test

* re-open existing tab instead of new tab after browser is loaded

* fix browser load, active tab not re-appearing bug

---------

Co-authored-by: Cal Leung <cleun007@gmail.com>

* dispaly nft info in browser (#5930)

* Clear Hex data when Token Transfer reverts ETH (#5839)

* clear hexdata when token updates to eth

* native token transaction data set to 0x

* use constants

* Ignore e2e test artifacts (#5998)

A `.gitignore` entry has been added for the `artifacts` directory that
gets generated locally when a Detox iOS e2e test fails.

* remove sonar config from actions that can be configured in the web portal (#6013)

* [ENHANCEMENT] E2E Permission system tests (#5910)

* detox permission system working.

* fix lint

* removing imported account steps.

* update steps in feature files.

* added constants for element locators and added new feature file

* fix linting

* update tests

* fix linting

* update test name

* delete wallet on permission system flow. need to set better timeouts to deal with toast

* remove redudant test steps.

* set baseline time

* fix step to dismiss keyboard and add console.log to spit out launch time to console.

* fix browser path

* update dapp

* fix tests from merge conflict.

* add long wait to terms of use modal to deal with flakiness on bitrise

* remove redundant test

* disabling the ToU test.

* Fix 18 JS type errors for TSC to output 683 TS/TSX errors (#5975)

* Fix 18 JS type errors exposing 683 TS/TSX errors

Minimum required to tackle remaining errors in 120 files

Follow-up to: #5879

Fix: #5878

Next: #5882

* Fix app/core/Engine.ts lint errors

* Revert "Fix app/core/Engine.ts lint errors"

This reverts commit 7ac7011.

* Fix app/core/Engine.ts lint errors

* Skip type checking library declaration files (#5882)

Fix: #5881

* [FEATURE] SDK Session Persistence (#5948)

* refactor: sdkconnect typescript rewrite and otp generation

* feat: permission management with otp deeplinks

* feat: modal ui for loading / feedback on sdk connection state

* feat: remove sdk settings from experimental

* feat: prevent empty title in transaction header

* feat: add otp in account approval modal

* feat: i18n on sdk feedback modal

* chore: cleanup comments

* chore: remove rememberme comments

* feat: use default codefi server url

* fix: missing otp actions

* chore: remove sdk from experiment description

* feat: mmsdk auto retrieve approved account on getProviderState

* chore: simplify logic for easier code readability

* feat: manage sdk backward compatibility

* feat: auto validate permission on deeplink reconnection

* fix: typo

* fix: useeffect deps

* feat: new styling of otp

* chore: remove comments

* feat: remove unnecessary view

* feat: remove unnecessary view

* chore: linting and typos

* chore: more linting adjustments

* fix: invalid json file

* fix: update jest snapshot for accountoverview

* chore: remove extra space

* feat: remove plaintext option used to debug protocol

* chore: remove unused text

* feat: move modal from drawer to root navigation

* feat: edit i18n values and remove unused text

* chore: remove console logs

* feat: use theme typography in createstyle

* feat: use navigation instead of redux store to display loading state

* feat: update snapshot after ui changes

* chore: remove unused code + linting

* fix: invalid typography

* fix: rename for valid camelcase

* chore: cleanup

* chore: remove unused code

* feat: consolidate action params within connect uri

* feat: add do not remember channel option

* feat: use useAssetFromTheme hook for loading modal

* fix: linting

* chore: remove console logs

* feat: remove sdk modal references

* feat: extract onconfirm action to component props

* fix: prevent opening inappbrowser on connect deeplink

* feat: update ui according to latest design file

* feat: prevent invalid connection interruption when paused

* feat: display sorted connection list

* feat: send metamask wallet version to connected clients

* feat: replace fontstyles with typography in account approval modal

* chore: consolidate sdk constants to AppConstants

* chore: formatting

* fix: duplicated imports

* build: update communication layer dep to 0.2.0

* chore: disable debug logs

* chore: prevent linting error

* chore: remove comm layer

* chore: linting

* feat: replace navigation.goback with sheetRef.hide

* feat: remove fontSize when using typography

* feat: use Icon library instead of fontawesome

* feat: catchall title value

* feat: catchall title value

* Revert "Move `eth_sendTransaction` method handler to a separate module (#5968)" (#6021)

This reverts commit 49a6305.

* On-ramp: Add accessibility label to custom action images (#6016)

* disable back press and add margin to the bottom for accept ToU modal (#6023)

* On-ramp: Add #6009 strings (#6019)

* [FEATURE] Account selector on swaps screen (#5997)

* Account selector on swaps screen

* remove unused import

* update with comment and without justify content

* update with previous selected address

* add ellipsis to the account name if it is more than 13 chars

* feat: add consensys zkevm (Linea) support (#5958)

* feat: add consensys zkevm support

* fix: change consensys zkevm network name to Linea + change rpc url

* feat: add feature toggle for linea network

* feat: add two utility functions for block explorer url

* feat: add patches to support lineatestnet

* fix: add linea testnet as rpc network

* fix: updates imports

* Fix merge conflicts from merging main

* Fix trackEvents

* Fix missing import

* Fix for #5898 - Converting native ETH to fiat and fiat to native ETH results in wrong values beign displayed on the Amount screen (#5961)

* use setState callback to call onInputChange

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

* E2E for currency switch

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

* Lint fix

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

* Update snapshot

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

---------

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

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com>
Co-authored-by: Pedro Pablo Aste Kompen <wachunei@gmail.com>
Co-authored-by: sethkfman <10342624+sethkfman@users.noreply.github.com>
Co-authored-by: Curtis David <Curtis.David7@gmail.com>
Co-authored-by: Sylva Elendu <iamsylvaelendu@gmail.com>
Co-authored-by: José Manuel <6741785+jluque0101@users.noreply.github.com>
Co-authored-by: Owen Craston <owen.craston@consensys.net>
Co-authored-by: witmicko <witmicko@users.noreply.github.com>
Co-authored-by: tommasini <46944231+tommasini@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nicolas MASSART <NicolasMassart@users.noreply.github.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Olusegun Akintayo <trinisoftinc@gmail.com>
Co-authored-by: SamuelSalas <samuel.salas.reyes@gmail.com>
Co-authored-by: Matthew Epps <mepps32@gmail.com>
Co-authored-by: LeoTM <1881059+leotm@users.noreply.github.com>
Co-authored-by: abretonc7s <107169956+abretonc7s@users.noreply.github.com>
Co-authored-by: Victorien Gauch <85494462+VGau@users.noreply.github.com>

* Merge/6.2.0 merge from main (#6033)

* Revert "[Merge] Fix merge conflicts with main (#6031)"

This reverts commit ebd3e13.

* Revert "[MERGE] Merge main into 6.2.0 (#6029)"

This reverts commit 283fd0c.

* Merge/6.2.0 conflicts (#6034)

* Upgrade on-ramp-sdk to 1.9.0 (#5782)

* Update 6.1.2 changelog (#5953)

Update change log formatting and language

* E2E Establish performance baseline (#5947)

* set baseline time

* fix step to dismiss keyboard and add console.log to spit out launch time to console.

* add tags, create performance folder.

* remove scenario chaining

* change launch times

* Verify Contract Details (#5327)

* draft_token_allowance

* code cleanup

* fetch token address, nickname and image

* rebased to main

* styles should match design

* toggle blockexplorer state, token image

* validate address before saving

* token symbols

* implement feedback

* updated snapshot

* rebased to main

* remove unused code

* code cleanup

* code rebase and clean

* snapshot update

* test_address rewrite

* rebased to main

* rebased to main, QA issue fix

* QA issues fix

* fix QA issues

* update snapshot

* rebased to main

* updated to use the new network controller update

* remove unneccessary fallbacks

* INFRA-837: Add sonar integration (#5949)

* INFRA-837: Add sonar integration

* Update sonar branch

* Vault corruption recovery flow (#4421)

* Handle Vault Corruption
- trigger vault recovery flow in Login when error occurs
- fetch backup from vault and then reinitialize the engine with the
  backed up keyring
- we also destroy the old engine
- some local data might be lost but the accounts will be safe
- on fail we get them to create/import a new wallet
-  translations

* switch to nativeevent (#5960)

* Added translations for MC 0.5 (#5964)

* [FIX] Remove select address as a prop on App index.js (#5962)

* Remove select address as a prop on App index.js

* Update snapshot

* Bump @xmldom/xmldom from 0.8.3 to 0.8.6 (#5959)

Bumps [@xmldom/xmldom](https://github.com/xmldom/xmldom) from 0.8.3 to 0.8.6.
- [Release notes](https://github.com/xmldom/xmldom/releases)
- [Changelog](https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md)
- [Commits](xmldom/xmldom@0.8.3...0.8.6)

---
updated-dependencies:
- dependency-name: "@xmldom/xmldom"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump http-cache-semantics from 4.1.0 to 4.1.1 (#5669)

Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](kornelski/http-cache-semantics@v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Extract test accounts to env vars (#5952)

* make detox import SRP from accounts.js file.
* extract account infos to env vars
* update e2e instructions and add vars in .js.env template

---------

Co-authored-by: Curtis <Curtis.David7@gmail.com>

* improv: add workflow triggers for tags on release and QA (#5902)

update notifications

* [UPDATE] pin sonar action to commit (#5967)

* pin the sonar action to a specific commit

* format sonar file

* remove extra line from file

* [UPDATE] sonar action configuration (#5972)

* pin the sonar action to a specific commit

* format sonar file

* remove extra line from file

* bump the sonar checkout action version which will use compliant version of node

* configure sonar analysis directors, test path, exclusions

* added project & file configurations

* remove test directory argument and added more exclusions

* added more exclusions

* added test inclusions and root directory for tests

* Move `eth_sendTransaction` method handler to a separate module (#5968)

* Refactor `eth_sendTransaction` method handler

The method handler for `eth_sendTransaction` has been moved to a
separate module to simplify unit testing. Unit tests have been added
as well.

This module was written in TypeScript, which asked for some additional
validation of the method parameters. We now throw a more explicit
message when the params are missing, and when the transaction
parameters are not an object. Previously the method would still throw
an error in these scenarios, just with a less helpful message. The
change in error message should be the only functional change here.

This refactor is intended to make testing PR #5619 easier.

* Support `.cjs` file extensions

The Metro configuration has been updated to support `.cjs` file
extensions. The `@metamask/utils` dependency relies upon the library
`superstruct` which uses `.cjs` for its main exported module.

* fix: bundle video in app to prevent crash when not available (2nd attempt) (#5941)

- bundle video with embedded the subtitles in app
- add a readme in video folder to explain risks if video and subs files are moved or removed
- add a shell script running ffmpeg to regenerate the video
- remove useless constants and code related to remote SRP video resources.

* Send to multisig address. (#5931)

* Send to multisig address.

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

* Linter fix.

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

* Revert wdio changes

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

---------

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

* fixed iyarc format removed exclusions not needed, added exclusion for production value since the project is stilll maintained (#5978)

* [IMPLEMENT] Use Terms Modal (#5242)

* user terms modal builded

* use terms modal logic implemented

* small fix on translations

* remove old terms and conditions

* remove ts ignore

* fix typo

* create a MandatoryModal component

* readme and update props to generic names

* update snapshot

* changing && to ternary operator for a more accurate ui rendering

* added margin and added component to the storybook

* implemented webview to show the ToU

* scale font size

* clean

* fix snapshot

* fix lint

* analytics

* modal mandatory more agnostic

* Clean up styles and storybook

* Clean up on accept logic

* logic on util file termsOfUse

* scrolling webview on Android and reusable modal not dismissable

* Implemented option scroll needed on ModalMandatory

* update source of use terms

* fix import

* remove margin bottom

* english translation updated

* fix button import

* modal mandatory not dismissable

* change icon name

* use terms modal on android for existing users

* ToU called only called on nav/app component

* Revert "ToU called only called on nav/app component"

This reverts commit 7f2e12f.

* fix redirect on ToU modal to acessibility website

* fix track ecent

* E2e appium/5783 tou onboarding new app installs (#5951)

* Webdriverio and Detox test scripts for Term of use feature. Test scripts updated to have the term of use steps

* Small changes to fit browserstack

* Remove static-logos.js file changes

* move terms of use to before importing or create a new allet

* Update Detox and wdio test scripts to be compatible with the recept term of use changes

* Solve lint issues

---------

Co-authored-by: Cal Leung <cleun007@gmail.com>
Co-authored-by: SamuelSalas <samuel.salas.reyes@gmail.com>

* feat: add portfolio button to asset action buttons (#5785)

* feat: add portfolio button to asset action buttons

* Update app/components/UI/AccountOverview/index.js

Co-authored-by: Cal Leung <cleun007@gmail.com>

* chore: move portfolio url to AppConstants

* chore: fix minor issues

* chore: add event for portfolio link clicked

* chore: add snapshot test update

* chore: add translations

* add new icon type name

* chore: move portfolio button next to net worth

* chore: add progress

* fix: tab not updating properly

* move styles to stylesheet

* fix wallet index test

* remove logs and actually fix wallet index test

* re-open existing tab instead of new tab after browser is loaded

* fix browser load, active tab not re-appearing bug

---------

Co-authored-by: Cal Leung <cleun007@gmail.com>

* dispaly nft info in browser (#5930)

* Clear Hex data when Token Transfer reverts ETH (#5839)

* clear hexdata when token updates to eth

* native token transaction data set to 0x

* use constants

* Ignore e2e test artifacts (#5998)

A `.gitignore` entry has been added for the `artifacts` directory that
gets generated locally when a Detox iOS e2e test fails.

* remove sonar config from actions that can be configured in the web portal (#6013)

* [ENHANCEMENT] E2E Permission system tests (#5910)

* detox permission system working.

* fix lint

* removing imported account steps.

* update steps in feature files.

* added constants for element locators and added new feature file

* fix linting

* update tests

* fix linting

* update test name

* delete wallet on permission system flow. need to set better timeouts to deal with toast

* remove redudant test steps.

* set baseline time

* fix step to dismiss keyboard and add console.log to spit out launch time to console.

* fix browser path

* update dapp

* fix tests from merge conflict.

* add long wait to terms of use modal to deal with flakiness on bitrise

* remove redundant test

* disabling the ToU test.

* Fix 18 JS type errors for TSC to output 683 TS/TSX errors (#5975)

* Fix 18 JS type errors exposing 683 TS/TSX errors

Minimum required to tackle remaining errors in 120 files

Follow-up to: #5879

Fix: #5878

Next: #5882

* Fix app/core/Engine.ts lint errors

* Revert "Fix app/core/Engine.ts lint errors"

This reverts commit 7ac7011.

* Fix app/core/Engine.ts lint errors

* Skip type checking library declaration files (#5882)

Fix: #5881

* [FEATURE] SDK Session Persistence (#5948)

* refactor: sdkconnect typescript rewrite and otp generation

* feat: permission management with otp deeplinks

* feat: modal ui for loading / feedback on sdk connection state

* feat: remove sdk settings from experimental

* feat: prevent empty title in transaction header

* feat: add otp in account approval modal

* feat: i18n on sdk feedback modal

* chore: cleanup comments

* chore: remove rememberme comments

* feat: use default codefi server url

* fix: missing otp actions

* chore: remove sdk from experiment description

* feat: mmsdk auto retrieve approved account on getProviderState

* chore: simplify logic for easier code readability

* feat: manage sdk backward compatibility

* feat: auto validate permission on deeplink reconnection

* fix: typo

* fix: useeffect deps

* feat: new styling of otp

* chore: remove comments

* feat: remove unnecessary view

* feat: remove unnecessary view

* chore: linting and typos

* chore: more linting adjustments

* fix: invalid json file

* fix: update jest snapshot for accountoverview

* chore: remove extra space

* feat: remove plaintext option used to debug protocol

* chore: remove unused text

* feat: move modal from drawer to root navigation

* feat: edit i18n values and remove unused text

* chore: remove console logs

* feat: use theme typography in createstyle

* feat: use navigation instead of redux store to display loading state

* feat: update snapshot after ui changes

* chore: remove unused code + linting

* fix: invalid typography

* fix: rename for valid camelcase

* chore: cleanup

* chore: remove unused code

* feat: consolidate action params within connect uri

* feat: add do not remember channel option

* feat: use useAssetFromTheme hook for loading modal

* fix: linting

* chore: remove console logs

* feat: remove sdk modal references

* feat: extract onconfirm action to component props

* fix: prevent opening inappbrowser on connect deeplink

* feat: update ui according to latest design file

* feat: prevent invalid connection interruption when paused

* feat: display sorted connection list

* feat: send metamask wallet version to connected clients

* feat: replace fontstyles with typography in account approval modal

* chore: consolidate sdk constants to AppConstants

* chore: formatting

* fix: duplicated imports

* build: update communication layer dep to 0.2.0

* chore: disable debug logs

* chore: prevent linting error

* chore: remove comm layer

* chore: linting

* feat: replace navigation.goback with sheetRef.hide

* feat: remove fontSize when using typography

* feat: use Icon library instead of fontawesome

* feat: catchall title value

* feat: catchall title value

* Revert "Move `eth_sendTransaction` method handler to a separate module (#5968)" (#6021)

This reverts commit 49a6305.

* On-ramp: Add accessibility label to custom action images (#6016)

* disable back press and add margin to the bottom for accept ToU modal (#6023)

* On-ramp: Add #6009 strings (#6019)

* [FEATURE] Account selector on swaps screen (#5997)

* Account selector on swaps screen

* remove unused import

* update with comment and without justify content

* update with previous selected address

* add ellipsis to the account name if it is more than 13 chars

* feat: add consensys zkevm (Linea) support (#5958)

* feat: add consensys zkevm support

* fix: change consensys zkevm network name to Linea + change rpc url

* feat: add feature toggle for linea network

* feat: add two utility functions for block explorer url

* feat: add patches to support lineatestnet

* fix: add linea testnet as rpc network

* fix: updates imports

* Fix for #5898 - Converting native ETH to fiat and fiat to native ETH results in wrong values beign displayed on the Amount screen (#5961)

* use setState callback to call onInputChange

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

* E2E for currency switch

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

* Lint fix

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

* Update snapshot

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

---------

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

* Fix analytics

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com>
Co-authored-by: Pedro Pablo Aste Kompen <wachunei@gmail.com>
Co-authored-by: sethkfman <10342624+sethkfman@users.noreply.github.com>
Co-authored-by: Curtis David <Curtis.David7@gmail.com>
Co-authored-by: Sylva Elendu <iamsylvaelendu@gmail.com>
Co-authored-by: José Manuel <6741785+jluque0101@users.noreply.github.com>
Co-authored-by: Owen Craston <owen.craston@consensys.net>
Co-authored-by: witmicko <witmicko@users.noreply.github.com>
Co-authored-by: tommasini <46944231+tommasini@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nicolas MASSART <NicolasMassart@users.noreply.github.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Olusegun Akintayo <trinisoftinc@gmail.com>
Co-authored-by: SamuelSalas <samuel.salas.reyes@gmail.com>
Co-authored-by: Matthew Epps <mepps32@gmail.com>
Co-authored-by: LeoTM <1881059+leotm@users.noreply.github.com>
Co-authored-by: abretonc7s <107169956+abretonc7s@users.noreply.github.com>
Co-authored-by: Victorien Gauch <85494462+VGau@users.noreply.github.com>

* resolved yarn lint errors

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com>
Co-authored-by: metamaskbot <metamaskbot@users.noreply.github.com>
Co-authored-by: Cal Leung <cleun007@gmail.com>
Co-authored-by: Pedro Pablo Aste Kompen <wachunei@gmail.com>
Co-authored-by: Owen Craston <owen.craston@consensys.net>
Co-authored-by: sethkfman <10342624+sethkfman@users.noreply.github.com>
Co-authored-by: Sylva Elendu <iamsylvaelendu@gmail.com>
Co-authored-by: Curtis David <Curtis.David7@gmail.com>
Co-authored-by: José Manuel <6741785+jluque0101@users.noreply.github.com>
Co-authored-by: witmicko <witmicko@users.noreply.github.com>
Co-authored-by: tommasini <46944231+tommasini@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nicolas MASSART <NicolasMassart@users.noreply.github.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Olusegun Akintayo <trinisoftinc@gmail.com>
Co-authored-by: SamuelSalas <samuel.salas.reyes@gmail.com>
Co-authored-by: Matthew Epps <mepps32@gmail.com>
Co-authored-by: LeoTM <1881059+leotm@users.noreply.github.com>
Co-authored-by: abretonc7s <107169956+abretonc7s@users.noreply.github.com>
Co-authored-by: Victorien Gauch <85494462+VGau@users.noreply.github.com>
Co-authored-by: sethkfman <Seth.Kaufman@consensys.net>
Gudahtt added a commit that referenced this pull request Mar 28, 2023
The method handler for `eth_sendTransaction` has been moved to a
separate module to simplify unit testing. Unit tests have been added
as well.

This module was written in TypeScript, which asked for some additional
validation of the method parameters. We now throw a more explicit
message when the params are missing, and when the transaction
parameters are not an object. Previously the method would still throw
an error in these scenarios, just with a less helpful message. The
change in error message should be the only functional change here.

This refactor is intended to make testing PR #5619 easier.
@Gudahtt Gudahtt mentioned this pull request Mar 28, 2023
3 tasks
Gudahtt added a commit that referenced this pull request Mar 29, 2023
* Refactor `eth_sendTransaction` method handler

The method handler for `eth_sendTransaction` has been moved to a
separate module to simplify unit testing. Unit tests have been added
as well.

This module was written in TypeScript, which asked for some additional
validation of the method parameters. We now throw a more explicit
message when the params are missing, and when the transaction
parameters are not an object. Previously the method would still throw
an error in these scenarios, just with a less helpful message. The
change in error message should be the only functional change here.

This refactor is intended to make testing PR #5619 easier.

* Support `.cjs` file extensions

The Metro configuration has been updated to support `.cjs` file
extensions. The `@metamask/utils` dependency relies upon the library
`superstruct` which uses `.cjs` for its main exported module.

* Move utils dependency to 'dependencies'

* Inline functions from `@metamask/utils`

The two functions taken from `@metamask/utils` have been inlined as a
workaround to an error that gets thrown upon import on Android builds.

I'm still actively investigating that failure, so hopefully we can
replace these inlined functions soon.
@Gudahtt Gudahtt force-pushed the refactor-send-transaction-handler branch from 94e092d to 98c2f2d Compare March 29, 2023 03:50
@Gudahtt
Copy link
Member Author

Gudahtt commented Mar 29, 2023

I'm currently investigating iOS e2e test failures (they might be unrelated to these changes). This is still ready for review, particularly the unit tests, but I will update here when I have gotten the e2e tests working (it may require waiting for them to be fixed on main).

@Gudahtt Gudahtt force-pushed the refactor-send-transaction-handler branch 2 times, most recently from a58f2df to 9322d20 Compare March 30, 2023 19:44
@Gudahtt
Copy link
Member Author

Gudahtt commented Mar 30, 2023

I have completed additional local testing and found that the dapp API works as expected. I guess the e2e test failures were unrelated to these changes.

@Gudahtt Gudahtt requested a review from sethkfman March 30, 2023 20:17
The handler for `eth_sendTransaction` was previously spread between
`RPCMethodMiddleware.ts` and the static middleware of
`web3-provider-engine`. Instead it is all handled in
`RPCMethodMiddleware.ts` now.

This should have no functional impact. It is difficult to trace through
`web3-provider-engine`, but this case is one of the easier ones because
the static middleware is run first, and in this case it will always end
the request.

This relates to #5513
@Gudahtt Gudahtt force-pushed the refactor-send-transaction-handler branch from 9322d20 to 18bfcaf Compare April 4, 2023 22:18
Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Cal-L Cal-L added needs-qa Any New Features that needs a full manual QA prior to being added to a release. Spot Check on the Release Build If a ticket doesn't require feature QA, but does require some form of manual spot checking team-mobile-client release-6.4.0 PR for release 6.4.0 and removed needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) needs-qa Any New Features that needs a full manual QA prior to being added to a release. labels Apr 5, 2023
@Gudahtt Gudahtt merged commit 580c4d4 into main Apr 5, 2023
@Gudahtt Gudahtt deleted the refactor-send-transaction-handler branch April 5, 2023 22:27
@github-actions github-actions bot locked and limited conversation to collaborators Apr 5, 2023
@chrisleewilcox chrisleewilcox added needs-qa Any New Features that needs a full manual QA prior to being added to a release. and removed needs-qa Any New Features that needs a full manual QA prior to being added to a release. labels Apr 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-6.4.0 PR for release 6.4.0 Spot Check on the Release Build If a ticket doesn't require feature QA, but does require some form of manual spot checking team-mobile-platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants