* Premilimary Sanitize data logic.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* sanitizeData v2
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* sanitizeData: take 3
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Sanitize Data take 4
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Lint fixes
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Check that version is v4 before sanitizing.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* sanitize arrays.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Tests to check that typeless data are not shwon
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Lint Fixes
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Do not check value types, Iterate through the message, and ensure each property of the message is declared as a type
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Check that if data type is not defined, it is a solidity type.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Lint Fixes
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Code cleanup
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Move sanitizeData to utils
Tests for sanitizeData in utils
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Lint fixes
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Fix unit tests for signaturerequest
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Remove unused type
include fixedMxN and ufixedMxN checks.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* move fixtures to before each
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* invert if condition to avoid indentations.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Lint fixes
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* We should exclude types with [] at the beginning or middle as well:
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* cache nestedType
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Throw error for undefined/invalid types definition
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Throw if base type and types are not defined.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* 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>
The instructions for changing dependencies have been updated to include
the `yarn yarn-deduplicate` step. This command removes duplicate
dependencies in the lockfile where possible while keeping everything
in-range, and it's checked in CI in the `test-yarn-dedupe` job that was
added in #12737.
* 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>