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

fix: bug when requested accounts/chainIds do not match wallet state #29988

Merged
merged 66 commits into from
Jan 30, 2025

Conversation

adonesky1
Copy link
Contributor

@adonesky1 adonesky1 commented Jan 29, 2025

Description

Fix bug when requested accounts/chainIds do not match wallet state

Open in GitHub Codespaces

Manual testing steps

See videos below:

await window.ethereum.request({
 "method": "wallet_requestPermissions",
 "params": [
  {
    
    "eth_accounts": {
        "caveats": [
            {
                "type": "restrictReturnedAccounts",
                "value": []
            }
        ]
    },
    "endowment:permitted-chains": {
        "caveats": [
            {
                "type": "restrictNetworkSwitching",
                "value": ['0xbf04'] // any chainId not in the wallet
            }
        ]
    }
  }
],
});
await window.ethereum.request({
 "method": "wallet_requestPermissions",
 "params": [
  {
    
    "eth_accounts": {
        "caveats": [
            {
                "type": "restrictReturnedAccounts",
                "value": ["0x549f7D54F0a7ef67707c55dc51123586a2c6654e"] // any address not in the wallet
            }
        ]
    },
    "endowment:permitted-chains": {
        "caveats": [
            {
                "type": "restrictNetworkSwitching",
                "value": []
            }
        ]
    }
  }
],
});

Screenshots/Recordings

Before

Screen.Recording.2025-01-29.at.3.46.00.PM.mov
Screen.Recording.2025-01-29.at.3.47.16.PM.mov

After

Screen.Recording.2025-01-29.at.3.52.24.PM.mov
Screen.Recording.2025-01-29.at.3.53.30.PM.mov
Screen.Recording.2025-01-29.at.3.28.12.PM.mov

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.

ffmcgee725 and others added 30 commits January 21, 2025 18:43
…ons implementation to be fully caip25 compliant
Copy link
Contributor

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.

@adonesky1 adonesky1 force-pushed the ad/fix-connection-flow-invalid-requested-account branch from 1302be9 to 34fe314 Compare January 29, 2025 21:04
@adonesky1 adonesky1 changed the title fix bug when requested accounts/chainIds do not match wallet state fix: bug when requested accounts/chainIds do not match wallet state Jan 29, 2025
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Jan 29, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [dbce84a]
Page Load Metrics (1489 ± 96 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint29920771442326157
domContentLoaded12862022147719393
load12942074148919996
domInteractive228037199
backgroundConnect75017147
firstReactRender1479372613
getState440784
initialActions00000
loadScripts9161562107217383
setupStore785172110
uiStartup146027001704278134

Base automatically changed from jc/caip25-permission-refactor to main January 29, 2025 23:03
@david0xd david0xd requested a review from a team as a code owner January 29, 2025 23:03
@ffmcgee725 ffmcgee725 self-requested a review January 30, 2025 11:32
Copy link
Member

@ffmcgee725 ffmcgee725 left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@metamaskbot
Copy link
Collaborator

Builds ready [3eb6ade]
Page Load Metrics (1650 ± 85 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint14562024164917885
domContentLoaded14182016163617584
load14582028165017885
domInteractive237635136
backgroundConnect86319157
firstReactRender1593502612
getState45111136
initialActions01000
loadScripts10131553120015072
setupStore76615178
uiStartup161725811915258124
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 274 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@jiexi jiexi enabled auto-merge January 30, 2025 16:21
@jiexi jiexi added this pull request to the merge queue Jan 30, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [595ce45]
Page Load Metrics (1804 ± 58 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint27120401571549263
domContentLoaded15521987177511656
load15642002180412158
domInteractive246938136
backgroundConnect995282311
firstReactRender1698422713
getState490192311
initialActions01000
loadScripts11101519132311254
setupStore862212010
uiStartup17922595206818488
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 274 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Merged via the queue into main with commit 538bbc9 Jan 30, 2025
70 checks passed
@jiexi jiexi deleted the ad/fix-connection-flow-invalid-requested-account branch January 30, 2025 17:29
@github-actions github-actions bot locked and limited conversation to collaborators Jan 30, 2025
@metamaskbot metamaskbot added the release-12.12.0 Issue or pull request that will be included in release 12.12.0 label Jan 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
INVALID-PR-TEMPLATE PR's body doesn't match template release-12.12.0 Issue or pull request that will be included in release 12.12.0 team-wallet-api-platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants