* Fix tx-insight accreditation styling
- Ensure "Etherscan" appears capitalized
- Ensure messages are separated by newline
- Handle case where server returns `fetchedVia` that frontend doesn't
support
* Revert "Fix tx-insight accreditation styling"
This reverts commit f7121d23cf9e5cf37e18444793933c36b66d9028.
* New Fix tx-insight accreditation styling
Co-authored-by: Dan Miller <danjm.com@gmail.com>
* feature: adding support for truffle and etherscan accreditation
* Fix scss linting
* fix styling and classnames
* Switch font size to rem
* Update ui/components/app/transaction-decoding/components/ui/accreditation/accreditation.component.js
Co-authored-by: George Marshall <georgewrmarshall@gmail.com>
* Update ui/components/app/transaction-decoding/components/ui/accreditation/index.scss
Co-authored-by: George Marshall <georgewrmarshall@gmail.com>
* Update ui/components/app/transaction-decoding/components/ui/accreditation/accreditation.component.js
Co-authored-by: George Marshall <georgewrmarshall@gmail.com>
* Update ui/components/app/transaction-decoding/components/ui/accreditation/accreditation.component.js
Co-authored-by: George Marshall <georgewrmarshall@gmail.com>
* Fix linting
Co-authored-by: g. nicholas d'andrea <gnidan@trufflesuite.com>
Co-authored-by: Dan J Miller <danjm.com@gmail.com>
Co-authored-by: George Marshall <georgewrmarshall@gmail.com>
Co-authored-by: g. nicholas d'andrea <gnidan@users.noreply.github.com>
* Ensure that function representation on hex and data tabs are consistent
* Don't show redundant hex tab when deploying contract
* Show standard pointer cursor on error messages in tx-decoder component
* Don't show activity log for incoming transactions
* Update localization
* Fix error message
* 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
# Permission System 2.0
## Background
This PR migrates the extension permission system to [the new `PermissionController`](https://github.com/MetaMask/snaps-skunkworks/tree/main/packages/controllers/src/permissions).
The original permission system, based on [`rpc-cap`](https://github.com/MetaMask/rpc-cap), introduced [`ZCAP-LD`](https://w3c-ccg.github.io/zcap-ld/)-like permissions to our JSON-RPC stack.
We used it to [implement](https://github.com/MetaMask/metamask-extension/pull/7004) what we called "LoginPerSite" in [version 7.7.0](https://github.com/MetaMask/metamask-extension/releases/tag/v7.7.0) of the extension, which enabled the user to choose which accounts, if any, should be exposed to each dapp.
While that was a worthwhile feature in and of itself, we wanted a permission _system_ in order to enable everything we are going to with Snaps.
Unfortunately, the original permission system was difficult to use, and necessitated the creation of the original `PermissionsController` (note the "s"), which was more or less a wrapper for `rpc-cap`.
With this PR, we shake off the yoke of the original permission system, in favor of the modular, self-contained, ergonomic, and more mature permission system 2.0.
Note that [the `PermissionController` readme](https://github.com/MetaMask/snaps-skunkworks/tree/main/packages/controllers/src/permissions/README.md) explains how the new permission system works.
The `PermissionController` and `SubjectMetadataController` are currently shipped via `@metamask/snap-controllers`. This is a temporary state of affairs, and we'll move them to `@metamask/controllers` once they've landed in prod.
## Changes in Detail
First, the changes in this PR are not as big as they seem. Roughly half of the additions in this PR are fixtures in the test for the new migration (number 68), and a significant portion of the remaining ~2500 lines are due to find-and-replace changes in other test fixtures and UI files.
- The extension `PermissionsController` has been deleted, and completely replaced with the new `PermissionController` from [`@metamask/snap-controllers`](https://www.npmjs.com/package/@metamask/snap-controllers).
- The original `PermissionsController` "domain metadata" functionality is now managed by the new `SubjectMetadataController`, also from [`@metamask/snap-controllers`](https://www.npmjs.com/package/@metamask/snap-controllers).
- The permission activity and history log controller has been renamed `PermissionLogController` and has its own top-level state key, but is otherwise functionally equivalent to the existing implementation.
- Migration number 68 has been added to account for the new state changes.
- The tests in `app/scripts/controllers/permissions` have been migrated from `mocha` to `jest`.
Reviewers should focus their attention on the following files:
- `app/scripts/`
- `metamask-controller.js`
- This is where most of the integration work for the new `PermissionController` occurs.
Some functions that were internal to the original controller were moved here.
- `controllers/permissions/`
- `selectors.js`
- These selectors are for `ControllerMessenger` selector subscriptions. The actual subscriptions occur in `metamask-controller.js`. See the `ControllerMessenger` implementation for details.
- `specifications.js`
- The caveat and permission specifications are required by the new `PermissionController`, and are used to specify the `eth_accounts` permission and its JSON-RPC method implementation.
See the `PermissionController` readme for details.
- `migrations/068.js`
- The new state should be cross-referenced with the controllers that manage it.
The accompanying tests should also be thoroughly reviewed.
Some files may appear new but have just moved and/or been renamed:
- `app/scripts/lib/rpc-method-middleware/handlers/request-accounts.js`
- This was previously implemented in `controllers/permissions/permissionsMethodMiddleware.js`.
- `test/mocks/permissions.js`
- A truncated version of `test/mocks/permission-controller.js`.
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
A propType error was showing up during e2e tests with a `testDev`
build. It was caused by `process.env.IN_TEST` being treated as a
boolean, when in fact it is either the string `'true'` or a boolean.
`IN_TEST` has been updated to always be a boolean. `loose-envify` has
no trouble injecting boolean values, so there's no reason to treat this
as a string.
* conversion date fix
* update in settings conversion date - no internet
* update conversionDate fetch - setting container
* no currency date message updated
* integration for tx decoding confirmation and history view
* upgrading @truffle/decoder to latest release 5.1.0
* Update acorn and colors patches
* feat: remove redundant styling
* feat: basic integration for nickname components
* feat: wiring functionality of adding new nickname
* feat: wire functionality of showing nickname modal
* feat: link the nickname popover with add/update popover
* feat: moving forward with address nicknames integration
* feat: fixing a bug related to passing chainId in addressBook
* feat: populating memo prop in addressbook entry
* feat: add explorer link
* feat: bug fixing update nickname component
* feat: fix proptypes
* feat: adding tooltip for copying nickname address
* featL fix styling for tx-details page
* feat: optimize code for error handling
* feat: limiting transaction decoding to tx with data
* feat: remove tree UI component
* feat: adding request to check for tx decoding supported networks
* feat: showing data hex component
* feat: fix react warnings
* feat: remove extra margin in tx decoding
* Remove unused package @truffle/source-map-utils
* Ensure messages get translated
* feat: link tx-decoding addresses with nicknames
* Omit value for boolean attributes
* Fix props reading in CopyRawData
* fix: fixing issue with transaltion
* Fix lint errors in TransactionDecoding
- Remove unused import
- Reorder imports
- Address conflict between caught `error` and error state flag by
renaming state flag to `hasError`
- Fix requestUrl identifier casing and use of template string
- Ensure `useEffect` gets passed the deps it needs
- Add scope braces around case statement where it's needed
- Omit literal `true` for boolean jsx attribute
- Refactor nested ternary as `if` statements
* fix: revert fetchWithCache modifications
* Fix linting for TransactionListItemDetails
- Remove unused import
- Fix import spacing
- Remove unused prop dereference
- Fix string interpolation for translated From/To
* Moving to popover pattern
* fix: sass color variable
* Omit value for boolean attribute
* Remove changes from modal.js
* fix: refactor nickname popovers
* Ensure const gets declared before it's used
* Fix linting for ConfirmTransactionBase
- Remove unused prop chainId
- Stop destructuring an unused field
* fix: refactor usage of nicknames popovers in send-content-container
* fix: remove extra prop updateAccountNicknameModal
* fix: refactor code for address.component
* fix: remove extra tooltip
* Ensure NicknamePopovers always returns component
* Fix linting for NicknamePopover component
- Fix useCallback deps
- Switch ternary to logical-or
* Fix linting for SenderToRecipient
... by fixing import order
* Remove unused addressCopied state
* Delete empty file
* fix: remove sender-to-recipient.container
* fix: refactor usage of nickname popovers in confirm-page-container
* fix: bug related to state variable
* Stylelint fix
* Lint fix
* Change "Total Amount" to "Total"
* Lint fix locales
* Update address-book.spec.js
* e2e test update
* Update e2e tests
* Fix issue where absence of function params in data hex tab would result in rendering a string
* Fix border radius, and width and height in small notification windows, of the update-nickname-popover
* Remove fake await
* Clean up
* Clean up
Co-authored-by: Alaa Hadad <alaahd@Alaas-MacBook-M1-Pro-14-inch.local>
Co-authored-by: Dan Miller <danjm.com@gmail.com>
Co-authored-by: g. nicholas d'andrea <gnidan@trufflesuite.com>
* Add support for eip-1559 on Trezor
* temp
* Lint fix
* Store trezor model type in background state instead attempting to get it in the frontend
* code simplification
* Temp update to eth-trezor-keyring version
* Tempory update to eth-trezor-keyring version
* Temp update to eth-trezor-keyring version
* Fix display of hdpath selector in connect hardware flow for trezor
* Updating the package version but we still need to run yarn setup and update the lockfile, once the package is updated
* Update yarn.lock
* Fix unit tests
* Created a Nickname popover
* Fixing lines in index.scss
* Handle copy button and fix some paddings
* Added text to be editable in the storybook component
* Simplify nickname scss and html
* Delete harcoded address
* Change color usage with new color system
* support qr based signer
* add CSP for fire fox
* get QR Hardware wallet name from device
* fix qrHardware state missing in runtime
* support qr based signer sign transaction
* refine Request Signature modal ui
* remove feature toggle
* refine ui
* fix notification is closing even there is a pending qr hardware transaction
* add chinese translation, refine ui, fix qr process was breaking in some case
* support import accounts by pubkeys
* refine qr-based wallet ui and fix bugs
* update @keystonehq/metamask-airgapped-keyring to fix that the signing hd path was inconsistent in some edge case
* fix: avoid unnecessay navigation, fix ci
* refactor qr-hardware-popover with @zxing/browser
* update lavamoat policy, remove firefox CSP
* refine qr reader ui, ignore unnecessary warning display
* code refactor, use async functions insteads promise
Co-authored-by: Soralit <soralitria@gmail.com>
* If a transaction would revert/fail,
1. hide the gas estimate info.
2. Disable the confirm button.
3. All user to enable the confirm button anyways.
4. Do not show the default Transaction error message
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Always return a value for hasSimulationError
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Use primary button of action message
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Remove hasSimulationError from getErrorKey
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Lint fixes.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Move confirm anyways logic to base component.
Change message
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Disable edit if there's simulation error
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* hide confirm anyways button once clicked.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Move Actionable Primary Action to flex-end
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Fix unit tests
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Fix nested ternary lint issues
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* add !confirmAnyways to conditions to show GasDetails.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* ConfirmAnyways should be read from state
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Rename tryAnywayOption
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Lint fixes
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Remove await tick
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Lint issue fix
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Lint fixes after rebase
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* description should show that it's content being tested.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* If a transaction would revert/fail,
1. hide the gas estimate info.
2. Disable the confirm button.
3. All user to enable the confirm button anyways.
4. Do not show the default Transaction error message
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Always return a value for hasSimulationError
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Use primary button of action message
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Remove hasSimulationError from getErrorKey
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Lint fixes.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Move confirm anyways logic to base component.
Change message
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Disable edit if there's simulation error
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* hide confirm anyways button once clicked.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Move Actionable Primary Action to flex-end
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Fix unit tests
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Fix nested ternary lint issues
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* add !confirmAnyways to conditions to show GasDetails.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* ConfirmAnyways should be read from state
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Rename tryAnywayOption
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Lint fixes
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Remove await tick
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Lint issue fix
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Lint fixes after rebase
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* description should show that it's content being tested.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Move simulation fails message inline with gas details component (#12705)
* Move simulation fails message inline with gas details component
* Remove old unit tests
Co-authored-by: Dan Miller <danjm.com@gmail.com>
* lint fix
* use an XOR operation.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* The changes in this file are no longer needed because we hide the edit button now
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
Co-authored-by: Dan Miller <danjm.com@gmail.com>
* Add CollectiblesController
* bump controllers version
* add CollectibleDetectionController
* adapt to ERC1155 support changes in CollectiblesController
* update @metamask/controllers to v20.0.0
* update lavamoat policy files
* put collectibleDetectionController instantiation behind feature flag
* Fix#5039
* Converted function into async
* Added more explicit explanation of why the number of bits for EcSign
* eth_sign and eth_personalSign now report errors correctly back to the user
* Added leeway to unsigned message byte check
* Fix lint
These background API methods were not used anywhere in the UI. One of
them was called in `actions.js` by a function that itself was never
called, so it have been removed. Additionally, one unused `actions.js`
function was found and removed as well.
`setAdvancedGasFee` is the only unused background method that remains.
It was recently added and will be used in the near future.