Skip to content

feat(keyring-api)!: add scopes field to KeyringAccount#101

Merged
gantunesr merged 11 commits intomainfrom
feat/keyring-account-scopes
Dec 18, 2024
Merged

feat(keyring-api)!: add scopes field to KeyringAccount#101
gantunesr merged 11 commits intomainfrom
feat/keyring-account-scopes

Conversation

@ccharly
Copy link
Contributor

@ccharly ccharly commented Nov 22, 2024

@ccharly ccharly force-pushed the feat/keyring-account-scopes branch 2 times, most recently from 1bb66b2 to 22cd5fe Compare November 25, 2024 09:53
@ccharly
Copy link
Contributor Author

ccharly commented Nov 25, 2024

@metamaskbot publish-previews

@github-actions
Copy link

Preview builds have been published. See these instructions (from the core monorepo) for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/keyring-api": "11.0.0-22cd5fe",
  "@metamask-previews/eth-hd-keyring": "8.0.0-22cd5fe",
  "@metamask-previews/eth-ledger-bridge-keyring": "7.0.0-22cd5fe",
  "@metamask-previews/eth-simple-keyring": "8.0.0-22cd5fe",
  "@metamask-previews/eth-trezor-keyring": "6.0.0-22cd5fe",
  "@metamask-previews/eth-snap-keyring": "6.0.0-22cd5fe"
}

@ccharly ccharly force-pushed the feat/keyring-account-scopes branch from 22cd5fe to 7a50d54 Compare December 6, 2024 15:55
@ccharly ccharly force-pushed the feat/keyring-account-scopes branch from 7a50d54 to ab1eaab Compare December 9, 2024 10:24
@ccharly
Copy link
Contributor Author

ccharly commented Dec 13, 2024

@metamaskbot publish-previews

@socket-security
Copy link

socket-security bot commented Dec 13, 2024

No dependency changes detected. Learn more about Socket for GitHub ↗︎

👍 No dependency changes detected in pull request

@ccharly
Copy link
Contributor Author

ccharly commented Dec 13, 2024

@metamaskbot publish-previews

@github-actions
Copy link

Preview builds have been published. See these instructions (from the core monorepo) for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/keyring-api": "12.0.0-ac29af4",
  "@metamask-previews/eth-hd-keyring": "9.0.1-ac29af4",
  "@metamask-previews/eth-ledger-bridge-keyring": "8.0.1-ac29af4",
  "@metamask-previews/eth-simple-keyring": "8.0.1-ac29af4",
  "@metamask-previews/eth-trezor-keyring": "6.0.1-ac29af4",
  "@metamask-previews/keyring-internal-api": "1.0.0-ac29af4",
  "@metamask-previews/keyring-internal-snap-client": "1.0.0-ac29af4",
  "@metamask-previews/eth-snap-keyring": "7.0.0-ac29af4",
  "@metamask-previews/keyring-snap-client": "1.0.0-ac29af4",
  "@metamask-previews/keyring-snap-sdk": "1.0.0-ac29af4",
  "@metamask-previews/keyring-utils": "1.0.0-ac29af4"
}

@ccharly ccharly changed the title feat!: add scopes field to KeyringAccount feat!: add scopes field to KeyringAccount Dec 13, 2024
@ccharly ccharly changed the title feat!: add scopes field to KeyringAccount feat(keyring-api)!: add scopes field to KeyringAccount Dec 13, 2024
@gantunesr gantunesr marked this pull request as ready for review December 18, 2024 15:46
@gantunesr gantunesr requested a review from a team as a code owner December 18, 2024 15:46
Co-authored-by: Dario Anongba Varela <dario.anongba@gmail.com>
@gantunesr gantunesr added this pull request to the merge queue Dec 18, 2024
Merged via the queue into main with commit a3e4dbd Dec 18, 2024
@gantunesr gantunesr deleted the feat/keyring-account-scopes branch December 18, 2024 16:29
ccharly added a commit to MetaMask/core that referenced this pull request Jan 9, 2025
## Explanation

Testing the new `scopes` field for `KeyringAccount`

## References

- MetaMask/accounts#101
- MetaMask/metamask-extension#29195

## Changelog

### `@metamask/accounts-controller`

- **CHANGED**: Bump `keyring-api` to `^13.0.0`
- **CHANGED**: Bump `keyring-internal-api` to `^1.1.0`
- **CHANGED**: **BREAKING:** Add new `scopes` field to `InternalAccount`
- This new field wil automatically defaults to `eip155` (CAIP-2 chain ID
namespace for EVM) for newly created EOA accounts (both Snap and
"normal" accounts).

### `@metamask/assets-controllers`

- **CHANGED**: Bump `keyring-internal-api` to `^1.1.0`

### `@metamask/chain-controller`

- **CHANGED**: Bump `keyring-internal-api` to `^1.1.0`

### `@metamask/keyring-controller`

- **CHANGED**: Bump `keyring-api` to `^13.0.0`
- **CHANGED**: Bump `keyring-internal-api` to `^1.1.0`
- **CHANGED**: Await for `generateRandomMnemonic` keyring calls
- Not all keyrings uses an `async` implementation for this method, but
`await`ing should cover both (synchronous and asynchronous) cases.
- This change is required since the bump of `@metamask/utils@^11.0.1`
that changed the `generateRandomMnemonic` function signature for the
`EthKeyring` interface (coming from `@metamask/keyring-internal-api`.

### `@metamask/profile-sync-controller`

- **CHANGED**: Bump `keyring-api` to `^13.0.0`
- **CHANGED**: Bump `keyring-internal-api` to `^1.1.0`

## Checklist

- [ ] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've highlighted breaking changes using the "BREAKING" category
above as appropriate
- [ ] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
PatrykLucka pushed a commit to MetaMask/core that referenced this pull request Jan 13, 2025
## Explanation

Testing the new `scopes` field for `KeyringAccount`

## References

- MetaMask/accounts#101
- MetaMask/metamask-extension#29195

## Changelog

### `@metamask/accounts-controller`

- **CHANGED**: Bump `keyring-api` to `^13.0.0`
- **CHANGED**: Bump `keyring-internal-api` to `^1.1.0`
- **CHANGED**: **BREAKING:** Add new `scopes` field to `InternalAccount`
- This new field wil automatically defaults to `eip155` (CAIP-2 chain ID
namespace for EVM) for newly created EOA accounts (both Snap and
"normal" accounts).

### `@metamask/assets-controllers`

- **CHANGED**: Bump `keyring-internal-api` to `^1.1.0`

### `@metamask/chain-controller`

- **CHANGED**: Bump `keyring-internal-api` to `^1.1.0`

### `@metamask/keyring-controller`

- **CHANGED**: Bump `keyring-api` to `^13.0.0`
- **CHANGED**: Bump `keyring-internal-api` to `^1.1.0`
- **CHANGED**: Await for `generateRandomMnemonic` keyring calls
- Not all keyrings uses an `async` implementation for this method, but
`await`ing should cover both (synchronous and asynchronous) cases.
- This change is required since the bump of `@metamask/utils@^11.0.1`
that changed the `generateRandomMnemonic` function signature for the
`EthKeyring` interface (coming from `@metamask/keyring-internal-api`.

### `@metamask/profile-sync-controller`

- **CHANGED**: Bump `keyring-api` to `^13.0.0`
- **CHANGED**: Bump `keyring-internal-api` to `^1.1.0`

## Checklist

- [ ] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've highlighted breaking changes using the "BREAKING" category
above as appropriate
- [ ] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
github-merge-queue bot pushed a commit to MetaMask/metamask-mobile that referenced this pull request Jan 16, 2025
# **Description**

The primary purpose of this PR is to update the accounts controller and
the assets-controller to the latest version. In doing that, there were
several other package updates that were needed. Here is a summary of the
updates...


# 🔴  Major updates 🔴 

### "@metamask/accounts-controller": "^20.0.1" -> ^21.0.0
-
[changelog](https://github.com/MetaMask/core/blob/main/packages/accounts-controller/CHANGELOG.md#2100)
- Breaking changes
- BREAKING: Add scopes field to KeyringAccount
(MetaMask/core#5066),
(MetaMask/core#5136)
This field is now required and will be used to identify the supported
chains (using CAIP-2 chain IDs) for every accounts.
- Changes
- Bump @metamask/base-controller from ^7.0.0 to ^7.1.1
(MetaMask/core#5079),
(MetaMask/core#5135)
- Bump @metamask/utils to ^11.0.1
(MetaMask/core#5080)
- Bump @metamask/rpc-errors to ^7.0.2
(MetaMask/core#5080)
- Use new @metamask/keyring-internal-api@^1.0.0
(MetaMask/core#4695)
This package has been split out from the Keyring API.
- Bump @metamask/keyring-api from ^10.1.0 to ^12.0.0
(MetaMask/core#4695)
- Bump @metamask/eth-snap-keyring from ^5.0.1 to ^7.0.0
(MetaMask/core#4695)
ESM/CommonJS support.

### "@metamask/assets-controllers": "^45.1.1", ->  ^46.0.0",
-
[changelog](https://github.com/MetaMask/core/blob/main/packages/assets-controllers/CHANGELOG.md#4600)
- Breaking changes
- BREAKING: Bump @metamask/accounts-controller peer dependency from
^20.0.0 to ^21.0.0 (MetaMask/core#5140)
- Changes
- Remove use of @metamask/keyring-api
(MetaMask/core#4695)
@metamask/providers and webextension-polyfill peer dependencies are no
longer required.
- Use new @metamask/keyring-internal-api@^1.0.0
(MetaMask/core#4695)
This package has been split out from the Keyring API. Its types are
compatible with the @metamask/keyring-api package used previously.
- Bump @metamask/base-controller from ^7.0.0 to ^7.1.1
(MetaMask/core#5079),
(MetaMask/core#5135)
- Bump @metamask/keyring-api from ^12.0.0 to ^13.0.0
(MetaMask/core#5066)
- Bump @metamask/utils to ^11.0.1
(MetaMask/core#5080)
- Bump @metamask/rpc-errors to ^7.0.2
(MetaMask/core#5080)
- Added
- Add new MultichainBalancesController
(MetaMask/core#4965)
This controller has been migrated from the MetaMask extension codebase.

### "@metamask/utils": "^10.0.1" -> ^11.0.1"
-
[changelog](https://github.com/MetaMask/utils/blob/main/CHANGELOG.md#1101)
- breaking changes
- BREAKING: generateRandomMnemonic now returns Promise<void> instead of
void (MetaMask/utils#222)

### Added "@metamask/keyring-internal-api": "^2.0.0",
-
[changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-internal-api/CHANGELOG.md#200)
- This package was a peer dep on the latest accounts controller and
assets controller. Given this I figured we should add it now anyway.
- Changes needed
- update imports from `@metamask/keyring-api` to
`@metamask/keyring-internal-api`
   - add support for scopes in the InternalAccount object
- added migration (066.ts) to backfill the scopes to existing accounts.
- This change is based off a [similar change made in the
extension](MetaMask/metamask-extension#29195)
made by @ccharly

### Added @metamask/keyring-snap-client: "^2.0.0"
-
[changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-snap-client/CHANGELOG.md#200)
- Added because KeyringClient is now exported from
`@metamask/keyring-snap-client` instead of `@metamask/keyring-api'`. See
`app/components/Views/AddAccountActions/AddAccountActions.tsx` for
changes.

### "@metamask/keyring-api": "^10.1.0", -> ^13.0.0"
-
[changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-api/CHANGELOG.md#1300)
- Breaking changes
- BREAKING: Add scopes field to KeyringAccount
(MetaMask/accounts#101)
- BREAKING: Split into several smaller packages
(MetaMask/accounts#24)
        - This should improve dependencies management.
- Internal related types (internal to both clients) have been moved to
keyring-internal-* packages.
- Keyring API clients (mainly used by dapps) have been moved to
keyring-snap-client package.
        - Common utils have been moevd to keyring-utils package.

### "@metamask/eth-snap-keyring": "^5.0.1" -> ^7.0.0"
-
[changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-eth-simple/CHANGELOG.md#700)
- breaking changes
- BREAKING: Increase minimum Node.js version to 16
(MetaMask/eth-simple-keyring#152)
- BREAKING: Bump @metamask/eth-sig-util from ^6.0.1 to ^7.0.0
(MetaMask/eth-simple-keyring#156)
- Bump @metamask/utils from ^5.0.0 to ^8.1.0
(MetaMask/eth-simple-keyring#153)
- Bump ethereum-cryptography from ^1.2.0 to ^2.1.2
(MetaMask/eth-simple-keyring#153)
- BREAKING: Bump @metamask/eth-sig-util dependency from ^7.0.3 to ^8.0.0
(MetaMask/accounts#79)
- signTypedData no longer support number for addresses, see
[here](https://github.com/MetaMask/eth-sig-util/blob/main/CHANGELOG.md#800).

## 🟡 Minor updates 🟡 

### "@metamask/base-controller": "^7.0.1", -> ^7.1.1
-
[changelog](https://github.com/MetaMask/core/blob/main/packages/base-controller/CHANGELOG.md#711)
- Changes
    -  Bump @metamask/utils from ^10.0.0 to ^11.0.1
- Rename ControllerMessenger to Messenger
(MetaMask/core#5050)
        - ControllerMessenger has been renamed to Messenger
- RestrictedControllerMessengerConstraint has been renamed to
RestrictedMessengerConstraint
- RestrictedControllerMessenger has been renamed to RestrictedMessenger
- The RestrictedMessenger constructor parameter controllerMessenger has
been renamed to messenger, though the old name is still accepted
- The old names remain exported as deprecated aliases of the new names,
so this is not a breaking change.

### "@metamask/providers": "^18.1.0" -> ^18.3.1"
-
[changelog](https://github.com/MetaMask/providers/blob/main/CHANGELOG.md#1831)
- Changes
- Bump @metamask/json-rpc-engine from ^10.0.1 to ^10.0.2
(MetaMask/providers#397)
- Bump @metamask/json-rpc-middleware-stream from ^8.0.5 to ^8.0.6
(MetaMask/providers#397)
- Bump @metamask/rpc-errors from ^7.0.1 to ^7.0.2
(MetaMask/providers#397)
- Bump @metamask/utils from ^10.0.0 to ^11.0.1
(MetaMask/providers#397)


## 🟢  Patch updates 🟢 

### "@metamask/json-rpc-engine": "^10.0.0" -> ^10.0.2",
-
[changelog](https://github.com/MetaMask/core/blob/main/packages/json-rpc-engine/CHANGELOG.md#1002)

### "@metamask/json-rpc-middleware-stream": "^8.0.2" -> 8.0.6"
-
[changelog](https://github.com/MetaMask/core/blob/main/packages/json-rpc-middleware-stream/CHANGELOG.md#806)
- changed
- Bump @metamask/json-rpc-engine from ^10.0.1 to ^10.0.2
(MetaMask/core#5082)
- Bump @metamask/utils from ^10.0.0 to ^11.0.1
(MetaMask/core#5080)

### "@metamask/rpc-errors": "^7.0.1" -> ^7.0.2"
-
[changelog](https://github.com/MetaMask/rpc-errors/blob/main/CHANGELOG.md#702)
- changes
- Bump @metamask/utils from ^10.0.0 to ^11.0.1
(MetaMask/rpc-errors#166)


## **Related issues**

Fixes: #12967
Fixes: #12966

Fixes: MetaMask/accounts-planning#758

Unblocks: #12599

## **Manual testing steps**

#### Basic import account flow with tokens


https://github.com/user-attachments/assets/1a8d3e59-34e4-413e-a3e8-7dbdc5f7424a



## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
github-merge-queue bot pushed a commit to MetaMask/metamask-extension that referenced this pull request Jan 21, 2025
## **Description**

Testing the new `scopes` added on the `KeyringAccount`.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/29195?quickstart=1)

## **Related issues**

Requires this PR to be merged first:
- [x] #28861

Related to:
- MetaMask/accounts#101
- MetaMask/core#5066
- MetaMask/snap-bitcoin-wallet#364

## **Manual testing steps**

- Use a previous stable version
```console
git checkout Version-v12.10.0 # Or use a release build
```

- Run it:
```console
yarn
yarn start:flask
```

- Create a bunch of accounts (EVM, non-EVM (Solana/Bitcoin),
hardware-wallet, Snap EVM accounts like the SSK)

![Screenshot 2025-01-16 at 17 11
55](https://github.com/user-attachments/assets/815303e6-2682-4c6b-9969-8f4a8c11e0d7)

- Save your extension logs (Settings > Advanced)
- Now disable your extension (chrome://extensions)
- Stops your `yarn start:flask`
- Now, update your extension by going back to this PR (or by using the
latest RC if you're validating an RC version)

```console
git checkout feat/keyring-account-scopes
```
- Re-run it:
```console
yarn
yarn start:flask
```
- Re-enable your extension (chrome://extensions)
- Open up your console logs (looking at the `service worker`)
- You should now see some migrations running like:

![Screenshot 2025-01-16 at 17 14
03](https://github.com/user-attachments/assets/35c08ba9-83f4-4827-aac5-97b9ee055732)

- You should also see some other migrations from the Snap keyring this
like so:

![Screenshot 2025-01-16 at 18 52
48](https://github.com/user-attachments/assets/5c74700c-18a4-4452-8a47-77d1434c96ad)

- Save your extension logs again (Settings > Advanced, and use a
different filename)
- Now, compare your 2 `.json` files

## **Screenshots/Recordings**

### **Before**

### **After**

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

---------

Co-authored-by: Howard Braham <howrad@gmail.com>
Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com>
github-merge-queue bot pushed a commit to MetaMask/metamask-mobile that referenced this pull request Feb 13, 2025
…ction controller etc) (#13436)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

This PR updates the
[AccountsController](https://github.com/MetaMask/core/blob/main/packages/accounts-controller/CHANGELOG.md#2310)
and the
[TransactionController](https://github.com/MetaMask/core/blob/main/packages/transaction-controller/CHANGELOG.md#4510).
These are the two major updates however there are a few smaller peer dep
updates as well. Here is a description of the changes...

### "@metamask/accounts-controller": "^21.0.0" -> 23.1.0"
-
[changelog](https://github.com/MetaMask/core/blob/main/packages/accounts-controller/CHANGELOG.md#2310)
- Breaking changes:
- BREAKING: Now requires
SnapKeyring:account{AssetList,Balances,Transactions}Updated events to be
registered on the messenger (MetaMask/core#5190)
- BREAKING: Bump @metamask/snaps-controllers peer dependency from ^9.7.0
to ^9.19.0 (MetaMask/core#5265)
    - Bump @metamask/base-controller from ^7.1.1 to ^8.0.0
- Non breaking changes:
- Bump @metamask/keyring-api" from ^16.1.0 to ^17.0.0
(MetaMask/core#5280)
- Bump @metamask/eth-snap-keyring from ^9.1.1 to ^10.0.0
(MetaMask/core#5280)
- Bump @metamask/snaps-sdk from ^6.7.0 to ^6.17.1
(MetaMask/core#5220),
(MetaMask/core#5265)
- Bump @metamask/snaps-utils from ^8.9.0 to ^8.10.0
(MetaMask/core#5265)

### "@metamask/transaction-controller": "^43.0.0" -> 45.1.0
-
[changelog](https://github.com/MetaMask/core/blob/main/packages/transaction-controller/CHANGELOG.md#4510)
- Breaking changes:
- BREAKING: Bump @metamask/accounts-controller peer dependency from
^22.0.0 to ^23.0.0

### "@metamask/keyring-api": "^13.0.0" -> 17.0.0
-
[changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-api/CHANGELOG.md#1700)
- Breaking changes:
- BREAKING: Make CaipAssetType type more restritive
(MetaMask/accounts#150) It used to be a string
but it has been restricted with a template literal type that matches
CAIP-19 asset type.
- BREAKING: Make specific *AccountStruct.scopes more strict
(MetaMask/accounts#159)
- BREAKING: Remove CAIP redefinitions
(MetaMask/accounts#167) We now rely on CAIP
definitions coming @metamask/utils.
- BREAKING: Enforce that scopes contains CAIP-2 chain IDs
(MetaMask/accounts#165) Initially scopes
accepted CAIP-2 namespaces as well to address the EVM EOA accounts that
supports all EVM chains. This has been dropped in favor of eip155:0
scope.
- BREAKING: Rename *Scopes enums to *Scope
(MetaMask/accounts#165)
- BREAKING: Use CaipAccountId for ResolvedAccountAddress.address
(MetaMask/accounts#186) This was missing from
SIP-26, but we expect this address to be CAIP-10 compliant.

### "@metamask/keyring-internal-api": "^2.0.0" -> 4.0.2
-
[changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-internal-api/CHANGELOG.md#402)
- Breaking changes
- BREAKING: Bump @metamask/keyring-api from ^14.0.0 to ^15.0.0
(MetaMask/accounts#160) The scopes from each
*AccountStruct types is now more strict which impact all
Internal*AccountStruct types.
- BREAKING: Bump @metamask/keyring-api from ^15.0.0 to ^16.0.0
(MetaMask/accounts#172)
The scopes from each *AccountStruct types is now more strict (remove
support of CAIP-2 namespaces) which impact all Internal*AccountStruct
types.
- Bump @metamask/keyring-api from ^16.1.0 to ^17.0.0
(MetaMask/accounts#192)

### "@metamask/eth-snap-keyring": "^7.1.0" -> 10.0.0
-
[changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-snap-bridge/CHANGELOG.md)
- Breaking changes:
- BREAKING: Bump @metamask/keyring-api from ^12.0.0 to ^13.0.0
(MetaMask/accounts#101)
This change was not properly reported as breaking on the 7.1.0.
KeyringAccount and InternalAccount have a new required field (scopes)
and are part of the public API.
- BREAKING: Bump @metamask/keyring-internal-api from ^1.0.0 to ^2.0.0
(MetaMask/accounts#135)
This change was not properly reported as breaking on the 7.1.0.
InternalAccount extends KeyringAccount which has a new required field
(scopes) and is part of the public API.
- BREAKING: Bump @metamask/keyring-snap-internal-client from ^1.0.0 to
^2.0.0 (MetaMask/accounts#135)
This change was not properly reported as breaking on the 7.1.0.
KeyringAccount has a new required field (scopes) and is part of the
public API.
- BREAKING: Use Messenger instead of SnapsController
(MetaMask/accounts#152)
This allows to break the runtime dependency we had with some snaps-*
pacakges.
- BREAKING: Make scopes more strict
(MetaMask/accounts#159)
We now use specific *AccountStucts when checking created/updated
accounts to make the scopes sent by the Snap are valid regarding their
account type definition.
- BREAKING: Use CaipAccountId for ResolvedAccountAddress.address
(MetaMask/accounts#186)
This was missing from SIP-26, but we expect this address to be CAIP-10
compliant.

### "@metamask/snaps-sdk": "^6.13.0" -> 6.17.1
-
[changelog](https://github.com/MetaMask/snaps/blob/main/packages/snaps-sdk/CHANGELOG.md#6171)
- no breaking changes

### "@metamask/snaps-utils": "^8.6.1" -> ^8.10.0
-
[changelog](https://github.com/MetaMask/snaps/blob/main/packages/snaps-utils/CHANGELOG.md#8100)
- no breaking changes

## **Related issues**

Fixes: #13374
Fixes: #13377

## **Manual testing steps**

#### Testing snap accounts
1. ensure you are building metamask flask by setting the value of
`METAMASK_BUILD_TYPE` to `flask` in your `.js.env`
2. source .js.env
3. yarn setup
4. yarn start:ios
5. create/import a wallet
6. click on the selected account at the top of the home page
7. click on the Add account button
8. then click the Add Solana account (Beta) button
9. a popup with a suggested name should appeaer
10. click OK, the account should now be added to your account list. if
you have a balance on this address then it should show in the portfolio
view.
11. repeat the above steps with the Bitcoin and Bitcoin testnet account

#### Testing transactions
1. ensure you are NOT building flask by setting the value of
`METAMASK_BUILD_TYPE` to `main` in your `.js.env`
2. source .js.env
3. yarn setup
4. yarn start:ios 
5. import an account that has funds
6. click on the selected account at the top of the screen and the
account list should open
7. then click on the add account button, then click add account
8. a new eth account should appear in your wallet
9. click on main bottom tab navigator icon which should open a list of
actions, select Send.
10. the Send flow should open.
11. set your from account to the account that has funds and the to
account to your newly created account.
12. type in a valid amount then go through the rest of the send flow
13. in the end the transaction should go through.
14. the account balances on the home page should be updated

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

On-boarding and Account Creation Flow


https://github.com/user-attachments/assets/2ccd8fb4-4857-4a99-ab52-cdb071bd0447

Send flow


https://github.com/user-attachments/assets/da81d49c-b472-49a7-83c4-1d1046521072


## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
christopherferreira9 pushed a commit to MetaMask/metamask-mobile that referenced this pull request Feb 14, 2025
…ction controller etc) (#13436)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

This PR updates the
[AccountsController](https://github.com/MetaMask/core/blob/main/packages/accounts-controller/CHANGELOG.md#2310)
and the
[TransactionController](https://github.com/MetaMask/core/blob/main/packages/transaction-controller/CHANGELOG.md#4510).
These are the two major updates however there are a few smaller peer dep
updates as well. Here is a description of the changes...

### "@metamask/accounts-controller": "^21.0.0" -> 23.1.0"
-
[changelog](https://github.com/MetaMask/core/blob/main/packages/accounts-controller/CHANGELOG.md#2310)
- Breaking changes:
- BREAKING: Now requires
SnapKeyring:account{AssetList,Balances,Transactions}Updated events to be
registered on the messenger (MetaMask/core#5190)
- BREAKING: Bump @metamask/snaps-controllers peer dependency from ^9.7.0
to ^9.19.0 (MetaMask/core#5265)
    - Bump @metamask/base-controller from ^7.1.1 to ^8.0.0
- Non breaking changes:
- Bump @metamask/keyring-api" from ^16.1.0 to ^17.0.0
(MetaMask/core#5280)
- Bump @metamask/eth-snap-keyring from ^9.1.1 to ^10.0.0
(MetaMask/core#5280)
- Bump @metamask/snaps-sdk from ^6.7.0 to ^6.17.1
(MetaMask/core#5220),
(MetaMask/core#5265)
- Bump @metamask/snaps-utils from ^8.9.0 to ^8.10.0
(MetaMask/core#5265)

### "@metamask/transaction-controller": "^43.0.0" -> 45.1.0
-
[changelog](https://github.com/MetaMask/core/blob/main/packages/transaction-controller/CHANGELOG.md#4510)
- Breaking changes:
- BREAKING: Bump @metamask/accounts-controller peer dependency from
^22.0.0 to ^23.0.0

### "@metamask/keyring-api": "^13.0.0" -> 17.0.0
-
[changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-api/CHANGELOG.md#1700)
- Breaking changes:
- BREAKING: Make CaipAssetType type more restritive
(MetaMask/accounts#150) It used to be a string
but it has been restricted with a template literal type that matches
CAIP-19 asset type.
- BREAKING: Make specific *AccountStruct.scopes more strict
(MetaMask/accounts#159)
- BREAKING: Remove CAIP redefinitions
(MetaMask/accounts#167) We now rely on CAIP
definitions coming @metamask/utils.
- BREAKING: Enforce that scopes contains CAIP-2 chain IDs
(MetaMask/accounts#165) Initially scopes
accepted CAIP-2 namespaces as well to address the EVM EOA accounts that
supports all EVM chains. This has been dropped in favor of eip155:0
scope.
- BREAKING: Rename *Scopes enums to *Scope
(MetaMask/accounts#165)
- BREAKING: Use CaipAccountId for ResolvedAccountAddress.address
(MetaMask/accounts#186) This was missing from
SIP-26, but we expect this address to be CAIP-10 compliant.

### "@metamask/keyring-internal-api": "^2.0.0" -> 4.0.2
-
[changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-internal-api/CHANGELOG.md#402)
- Breaking changes
- BREAKING: Bump @metamask/keyring-api from ^14.0.0 to ^15.0.0
(MetaMask/accounts#160) The scopes from each
*AccountStruct types is now more strict which impact all
Internal*AccountStruct types.
- BREAKING: Bump @metamask/keyring-api from ^15.0.0 to ^16.0.0
(MetaMask/accounts#172)
The scopes from each *AccountStruct types is now more strict (remove
support of CAIP-2 namespaces) which impact all Internal*AccountStruct
types.
- Bump @metamask/keyring-api from ^16.1.0 to ^17.0.0
(MetaMask/accounts#192)

### "@metamask/eth-snap-keyring": "^7.1.0" -> 10.0.0
-
[changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-snap-bridge/CHANGELOG.md)
- Breaking changes:
- BREAKING: Bump @metamask/keyring-api from ^12.0.0 to ^13.0.0
(MetaMask/accounts#101)
This change was not properly reported as breaking on the 7.1.0.
KeyringAccount and InternalAccount have a new required field (scopes)
and are part of the public API.
- BREAKING: Bump @metamask/keyring-internal-api from ^1.0.0 to ^2.0.0
(MetaMask/accounts#135)
This change was not properly reported as breaking on the 7.1.0.
InternalAccount extends KeyringAccount which has a new required field
(scopes) and is part of the public API.
- BREAKING: Bump @metamask/keyring-snap-internal-client from ^1.0.0 to
^2.0.0 (MetaMask/accounts#135)
This change was not properly reported as breaking on the 7.1.0.
KeyringAccount has a new required field (scopes) and is part of the
public API.
- BREAKING: Use Messenger instead of SnapsController
(MetaMask/accounts#152)
This allows to break the runtime dependency we had with some snaps-*
pacakges.
- BREAKING: Make scopes more strict
(MetaMask/accounts#159)
We now use specific *AccountStucts when checking created/updated
accounts to make the scopes sent by the Snap are valid regarding their
account type definition.
- BREAKING: Use CaipAccountId for ResolvedAccountAddress.address
(MetaMask/accounts#186)
This was missing from SIP-26, but we expect this address to be CAIP-10
compliant.

### "@metamask/snaps-sdk": "^6.13.0" -> 6.17.1
-
[changelog](https://github.com/MetaMask/snaps/blob/main/packages/snaps-sdk/CHANGELOG.md#6171)
- no breaking changes

### "@metamask/snaps-utils": "^8.6.1" -> ^8.10.0
-
[changelog](https://github.com/MetaMask/snaps/blob/main/packages/snaps-utils/CHANGELOG.md#8100)
- no breaking changes

## **Related issues**

Fixes: #13374
Fixes: #13377

## **Manual testing steps**

#### Testing snap accounts
1. ensure you are building metamask flask by setting the value of
`METAMASK_BUILD_TYPE` to `flask` in your `.js.env`
2. source .js.env
3. yarn setup
4. yarn start:ios
5. create/import a wallet
6. click on the selected account at the top of the home page
7. click on the Add account button
8. then click the Add Solana account (Beta) button
9. a popup with a suggested name should appeaer
10. click OK, the account should now be added to your account list. if
you have a balance on this address then it should show in the portfolio
view.
11. repeat the above steps with the Bitcoin and Bitcoin testnet account

#### Testing transactions
1. ensure you are NOT building flask by setting the value of
`METAMASK_BUILD_TYPE` to `main` in your `.js.env`
2. source .js.env
3. yarn setup
4. yarn start:ios 
5. import an account that has funds
6. click on the selected account at the top of the screen and the
account list should open
7. then click on the add account button, then click add account
8. a new eth account should appear in your wallet
9. click on main bottom tab navigator icon which should open a list of
actions, select Send.
10. the Send flow should open.
11. set your from account to the account that has funds and the to
account to your newly created account.
12. type in a valid amount then go through the rest of the send flow
13. in the end the transaction should go through.
14. the account balances on the home page should be updated

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

On-boarding and Account Creation Flow


https://github.com/user-attachments/assets/2ccd8fb4-4857-4a99-ab52-cdb071bd0447

Send flow


https://github.com/user-attachments/assets/da81d49c-b472-49a7-83c4-1d1046521072


## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
MarioAslau pushed a commit to MetaMask/metamask-mobile that referenced this pull request Feb 14, 2025
…ction controller etc) (#13436)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

This PR updates the
[AccountsController](https://github.com/MetaMask/core/blob/main/packages/accounts-controller/CHANGELOG.md#2310)
and the
[TransactionController](https://github.com/MetaMask/core/blob/main/packages/transaction-controller/CHANGELOG.md#4510).
These are the two major updates however there are a few smaller peer dep
updates as well. Here is a description of the changes...

-
[changelog](https://github.com/MetaMask/core/blob/main/packages/accounts-controller/CHANGELOG.md#2310)
- Breaking changes:
- BREAKING: Now requires
SnapKeyring:account{AssetList,Balances,Transactions}Updated events to be
registered on the messenger (MetaMask/core#5190)
- BREAKING: Bump @metamask/snaps-controllers peer dependency from ^9.7.0
to ^9.19.0 (MetaMask/core#5265)
    - Bump @metamask/base-controller from ^7.1.1 to ^8.0.0
- Non breaking changes:
- Bump @metamask/keyring-api" from ^16.1.0 to ^17.0.0
(MetaMask/core#5280)
- Bump @metamask/eth-snap-keyring from ^9.1.1 to ^10.0.0
(MetaMask/core#5280)
- Bump @metamask/snaps-sdk from ^6.7.0 to ^6.17.1
(MetaMask/core#5220),
(MetaMask/core#5265)
- Bump @metamask/snaps-utils from ^8.9.0 to ^8.10.0
(MetaMask/core#5265)

-
[changelog](https://github.com/MetaMask/core/blob/main/packages/transaction-controller/CHANGELOG.md#4510)
- Breaking changes:
- BREAKING: Bump @metamask/accounts-controller peer dependency from
^22.0.0 to ^23.0.0

-
[changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-api/CHANGELOG.md#1700)
- Breaking changes:
- BREAKING: Make CaipAssetType type more restritive
(MetaMask/accounts#150) It used to be a string
but it has been restricted with a template literal type that matches
CAIP-19 asset type.
- BREAKING: Make specific *AccountStruct.scopes more strict
(MetaMask/accounts#159)
- BREAKING: Remove CAIP redefinitions
(MetaMask/accounts#167) We now rely on CAIP
definitions coming @metamask/utils.
- BREAKING: Enforce that scopes contains CAIP-2 chain IDs
(MetaMask/accounts#165) Initially scopes
accepted CAIP-2 namespaces as well to address the EVM EOA accounts that
supports all EVM chains. This has been dropped in favor of eip155:0
scope.
- BREAKING: Rename *Scopes enums to *Scope
(MetaMask/accounts#165)
- BREAKING: Use CaipAccountId for ResolvedAccountAddress.address
(MetaMask/accounts#186) This was missing from
SIP-26, but we expect this address to be CAIP-10 compliant.

-
[changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-internal-api/CHANGELOG.md#402)
- Breaking changes
- BREAKING: Bump @metamask/keyring-api from ^14.0.0 to ^15.0.0
(MetaMask/accounts#160) The scopes from each
*AccountStruct types is now more strict which impact all
Internal*AccountStruct types.
- BREAKING: Bump @metamask/keyring-api from ^15.0.0 to ^16.0.0
(MetaMask/accounts#172)
The scopes from each *AccountStruct types is now more strict (remove
support of CAIP-2 namespaces) which impact all Internal*AccountStruct
types.
- Bump @metamask/keyring-api from ^16.1.0 to ^17.0.0
(MetaMask/accounts#192)

-
[changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-snap-bridge/CHANGELOG.md)
- Breaking changes:
- BREAKING: Bump @metamask/keyring-api from ^12.0.0 to ^13.0.0
(MetaMask/accounts#101)
This change was not properly reported as breaking on the 7.1.0.
KeyringAccount and InternalAccount have a new required field (scopes)
and are part of the public API.
- BREAKING: Bump @metamask/keyring-internal-api from ^1.0.0 to ^2.0.0
(MetaMask/accounts#135)
This change was not properly reported as breaking on the 7.1.0.
InternalAccount extends KeyringAccount which has a new required field
(scopes) and is part of the public API.
- BREAKING: Bump @metamask/keyring-snap-internal-client from ^1.0.0 to
^2.0.0 (MetaMask/accounts#135)
This change was not properly reported as breaking on the 7.1.0.
KeyringAccount has a new required field (scopes) and is part of the
public API.
- BREAKING: Use Messenger instead of SnapsController
(MetaMask/accounts#152)
This allows to break the runtime dependency we had with some snaps-*
pacakges.
- BREAKING: Make scopes more strict
(MetaMask/accounts#159)
We now use specific *AccountStucts when checking created/updated
accounts to make the scopes sent by the Snap are valid regarding their
account type definition.
- BREAKING: Use CaipAccountId for ResolvedAccountAddress.address
(MetaMask/accounts#186)
This was missing from SIP-26, but we expect this address to be CAIP-10
compliant.

-
[changelog](https://github.com/MetaMask/snaps/blob/main/packages/snaps-sdk/CHANGELOG.md#6171)
- no breaking changes

-
[changelog](https://github.com/MetaMask/snaps/blob/main/packages/snaps-utils/CHANGELOG.md#8100)
- no breaking changes

Fixes: #13374
Fixes: #13377

1. ensure you are building metamask flask by setting the value of
`METAMASK_BUILD_TYPE` to `flask` in your `.js.env`
2. source .js.env
3. yarn setup
4. yarn start:ios
5. create/import a wallet
6. click on the selected account at the top of the home page
7. click on the Add account button
8. then click the Add Solana account (Beta) button
9. a popup with a suggested name should appeaer
10. click OK, the account should now be added to your account list. if
you have a balance on this address then it should show in the portfolio
view.
11. repeat the above steps with the Bitcoin and Bitcoin testnet account

1. ensure you are NOT building flask by setting the value of
`METAMASK_BUILD_TYPE` to `main` in your `.js.env`
2. source .js.env
3. yarn setup
4. yarn start:ios
5. import an account that has funds
6. click on the selected account at the top of the screen and the
account list should open
7. then click on the add account button, then click add account
8. a new eth account should appear in your wallet
9. click on main bottom tab navigator icon which should open a list of
actions, select Send.
10. the Send flow should open.
11. set your from account to the account that has funds and the to
account to your newly created account.
12. type in a valid amount then go through the rest of the send flow
13. in the end the transaction should go through.
14. the account balances on the home page should be updated

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

<!-- [screenshots/recordings] -->

On-boarding and Account Creation Flow

https://github.com/user-attachments/assets/2ccd8fb4-4857-4a99-ab52-cdb071bd0447

Send flow

https://github.com/user-attachments/assets/da81d49c-b472-49a7-83c4-1d1046521072

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants