Skip to content

feat: add AccountTreeController #33499

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

ccharly
Copy link
Contributor

@ccharly ccharly commented Jun 5, 2025

Description

Integrating the new AccountTreeController. For now, it's not being used by any other UI components, but other PRs will follow on that.

Open in GitHub Codespaces

Related issues

N/A

Manual testing steps

  1. Onboard your wallet
  2. Create some accounts (HD accounts + private keys)
  3. Import some SRPs
  4. Install the SSK Snap and create accounts with its dapp:
  1. Download the state logs and look at the state with jq '.metamask.accountTree' state.json:
{
  "wallets": {
    "entropy:01JX08ABR2KRR210DXXYB92H47": {
      "id": "entropy:01JX08ABR2KRR210DXXYB92H47",
      "groups": {
        "entropy:01JX08ABR2KRR210DXXYB92H47:default": {
          "id": "entropy:01JX08ABR2KRR210DXXYB92H47:default",
          "accounts": [
            "fe7bdb6b-6644-4cf0-a540-800434643e8d",
            "fa3ca5c5-e0f7-473f-a041-e05e00736183"
          ],
          "metadata": {
            "name": "Default"
          }
        }
      },
      "metadata": {
        "name": "Wallet 1"
      }
    },
    "entropy:01JX08BFVDY3DPBTKYYYJD3X9Y": {
      "id": "entropy:01JX08BFVDY3DPBTKYYYJD3X9Y",
      "groups": {
        "entropy:01JX08BFVDY3DPBTKYYYJD3X9Y:default": {
          "id": "entropy:01JX08BFVDY3DPBTKYYYJD3X9Y:default",
          "accounts": [
            "48d6203c-92eb-4ee0-aefa-f3ca78d30d25",
            "c748a96d-7ba0-4c96-945c-27d308a28348",
            "d11897a0-8aac-4959-861d-f1e3858fdad2"
          ],
          "metadata": {
            "name": "Default"
          }
        }
      },
      "metadata": {
        "name": "Wallet 2"
      }
    },
    "entropy:01JX08C7WM3W7YWZM2EEPMBHBG": {
      "id": "entropy:01JX08C7WM3W7YWZM2EEPMBHBG",
      "groups": {
        "entropy:01JX08C7WM3W7YWZM2EEPMBHBG:default": {
          "id": "entropy:01JX08C7WM3W7YWZM2EEPMBHBG:default",
          "accounts": [
            "0b3368de-aeae-4633-9434-54634444a96a",
            "7b7fdcd8-ca48-4470-835c-f7703ea256e8"
          ],
          "metadata": {
            "name": "Default"
          }
        }
      },
      "metadata": {
        "name": "Wallet 3"
      }
    },
    "keyring:Simple Key Pair": {
      "id": "keyring:Simple Key Pair",
      "groups": {
        "keyring:Simple Key Pair:default": {
          "id": "keyring:Simple Key Pair:default",
          "accounts": [
            "9f6bd546-5a6a-46f4-908f-23c48c0841df",
            "a0b0d8fb-c6f4-4797-bcac-3cd7be53c07e"
          ],
          "metadata": {
            "name": "Default"
          }
        }
      },
      "metadata": {
        "name": "Private Keys"
      }
    },
    "snap:npm:@metamask/snap-simple-keyring-snap": {
      "id": "snap:npm:@metamask/snap-simple-keyring-snap",
      "groups": {
        "snap:npm:@metamask/snap-simple-keyring-snap:default": {
          "id": "snap:npm:@metamask/snap-simple-keyring-snap:default",
          "accounts": [
            "27fd6c96-9d41-4faa-bf69-73f00591c754",
            "95176c97-da1b-400c-8aa4-2f4b3bbb1c1b"
          ],
          "metadata": {
            "name": "Default"
          }
        }
      },
      "metadata": {
        "name": "Snap: MetaMask Simple Snap Keyring"
      }
    }
  }
}

Screenshots/Recordings

Before

After

Pre-merge author checklist

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.

Copy link
Contributor

github-actions bot commented Jun 5, 2025

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Copy link

socket-security bot commented Jun 5, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​metamask/​account-tree-controller@​0.1.0721007189100

View full report

@ccharly ccharly force-pushed the feat/account-tree-controller branch from 317e3a1 to 2a7f0ee Compare June 5, 2025 14:56
@ccharly ccharly requested review from a team as code owners June 5, 2025 14:56
@metamaskbot
Copy link
Collaborator

✨ Files requiring CODEOWNER review ✨

🧩 @MetaMask/extension-devs (3 files, +39 -9)
  • 📁 lavamoat/
    • 📁 browserify/
      • 📁 beta/
        • 📄 policy.json +13 -3
      • 📁 flask/
        • 📄 policy.json +13 -3
      • 📁 main/
        • 📄 policy.json +13 -3

📜 @MetaMask/policy-reviewers (3 files, +39 -9)

[!TIP]
Follow the policy review process outlined in the LavaMoat Policy Review Process doc before expecting an approval from Policy Reviewers.

  • 📁 lavamoat/
    • 📁 browserify/
      • 📁 beta/
        • 📄 policy.json +13 -3
      • 📁 flask/
        • 📄 policy.json +13 -3
      • 📁 main/
        • 📄 policy.json +13 -3

🔗 @MetaMask/supply-chain (3 files, +39 -9)
  • 📁 lavamoat/
    • 📁 browserify/
      • 📁 beta/
        • 📄 policy.json +13 -3
      • 📁 flask/
        • 📄 policy.json +13 -3
      • 📁 main/
        • 📄 policy.json +13 -3

@metamaskbot
Copy link
Collaborator

Builds ready [2a7f0ee]
UI Startup Metrics (1259 ± 67 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1259113214476713061391
load109297113036911361214
domContentLoaded108496612967011291210
domInteractive18144951729
firstPaint808141130241811231192
backgroundConnect84314920
firstReactRender20163742129
getState1463172028
initialActions001001
loadScripts832723102068883960
setupStore85202812
WebpackHomeuiStartup21301631261924423082495
load16601276201919217871918
domContentLoaded16541272200419017831906
domInteractive161160101342
firstPaint1707650370193313
backgroundConnect22105682537
firstReactRender13543364100125332
getState1144361219
initialActions316134
loadScripts16511271199318917821895
setupStore3273256819295
FirefoxBrowserifyHomeuiStartup13191146184311013531505
load1168100814478112141312
domContentLoaded1168100814478112141312
domInteractive923319130105150
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2213253251928
firstReactRender23203322327
getState84818810
initialActions001001
loadScripts115199313587811961298
setupStore11333335612
WebpackHomeuiStartup15891369208713316581849
load13701192171610114441555
domContentLoaded13701192171510114441554
domInteractive78321551886121
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2416217212342
firstReactRender42285144548
getState14525733931
initialActions102111
loadScripts1349117715759614241531
setupStore12524832814
Benchmark value 1260 exceeds gate value 1234 for chrome browserify home mean uiStartup
Benchmark value 1092 exceeds gate value 1070 for chrome browserify home mean load
Benchmark value 1085 exceeds gate value 1061 for chrome browserify home mean domContentLoaded
Benchmark value 808 exceeds gate value 800 for chrome browserify home mean firstPaint
Benchmark value 833 exceeds gate value 830 for chrome browserify home mean loadScripts
Benchmark value 1391 exceeds gate value 1365 for chrome browserify home p95 uiStartup
Benchmark value 1215 exceeds gate value 1190 for chrome browserify home p95 load
Benchmark value 1210 exceeds gate value 1180 for chrome browserify home p95 domContentLoaded
Benchmark value 1193 exceeds gate value 1180 for chrome browserify home p95 firstPaint
Benchmark value 21 exceeds gate value 18 for chrome browserify home p95 backgroundConnect
Benchmark value 961 exceeds gate value 940 for chrome browserify home p95 loadScripts
Benchmark value 33 exceeds gate value 32 for chrome webpack home mean setupStore
Benchmark value 2495 exceeds gate value 2454 for chrome webpack home p95 uiStartup
Benchmark value 295 exceeds gate value 65 for chrome webpack home p95 setupStore
Benchmark value 11 exceeds gate value 9 for firefox browserify home mean setupStore
Benchmark value 43 exceeds gate value 38 for firefox webpack home mean firstReactRender
Sum of mean exceeds: 91ms | Sum of p95 exceeds: 389ms
Sum of all benchmark exceeds: 480ms

Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 9.37 KiB (0.18%)
  • ui: 1.68 KiB (0.02%)
  • common: -684 Bytes (-0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants