Skip to content

feat: Solana accountChanged event #15561

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

Merged
merged 71 commits into from
Jun 2, 2025

Conversation

jiexi
Copy link
Contributor

@jiexi jiexi commented May 22, 2025

Description

  • Adds solana accountChange support
  • Fixes issue with selecting non-evm account from dapp account switcher

Related issues

Fixes:

Manual testing steps

  1. yarn setup
  2. yarn start:ios:flask
  3. Launch flask build
  4. Make two solana accounts
  5. Go to any webpage with in app browser
  6. Enter the block of code below in the Safari dev console for the webpage (Open safari on your computer, Click Develop, Select the metamask app browser tab running in the simulator. You have to enable safari dev mode first)
  7. Permit 2 solana accounts and 1 eth account (the eth account is needed so that you can get back into modifying the permissions since there is a bug with the selectors right now)
  8. Play around
window.addEventListener('message', (event) => {
  const {
    target,
    data
  } = event.data;
  if (
    target !== "metamask-inpage" ||
    data?.name !== 'metamask-multichain-provider'
  ) {
    return;
  }
  console.log(data.data)
})

const caipPostMessage = (data) => {
  window.postMessage({
    target: 'metamask-contentscript',
    data: {
      name: 'metamask-multichain-provider',
      data
    }
  }, location.origin)
}

caipPostMessage({
    jsonrpc: "2.0",
    method: "wallet_createSession",
    params: {
      optionalScopes: {
        "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": {
          methods: [],
          notifications: [],
          accounts: [],
        },
      },
      sessionProperties: {
        solana_accountChanged_notifications: true,
      },
    },
  })

Screenshots/Recordings

Before

After

Screen.Recording.2025-05-22.at.2.54.56.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.

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.

@jiexi jiexi added the Run Smoke E2E Requires smoke E2E testing label May 30, 2025
Copy link
Contributor

github-actions bot commented May 30, 2025

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 8dd30f4
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/3ad12d6e-4df4-4d55-be2c-c90e8e825f7e

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@adonesky1
Copy link
Contributor

Tested/validated latest and all functionality is looking great!

ffmcgee725
ffmcgee725 previously approved these changes Jun 2, 2025
adonesky1
adonesky1 previously approved these changes Jun 2, 2025
Copy link
Contributor

@adonesky1 adonesky1 left a comment

Choose a reason for hiding this comment

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

LGTM. Just small non blocking nits

@jiexi jiexi dismissed stale reviews from adonesky1 and ffmcgee725 via 3367e5e June 2, 2025 17:17
Copy link

sonarqubecloud bot commented Jun 2, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
75.4% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copy link
Contributor

@sethkfman sethkfman left a comment

Choose a reason for hiding this comment

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

LGTM. Reviewed the browser changes for the platform

@github-project-automation github-project-automation bot moved this from Review in progress to Review finalised - Ready to be merged in PR review queue Jun 2, 2025
@adonesky1 adonesky1 added Run Smoke E2E Requires smoke E2E testing and removed Run Smoke E2E Requires smoke E2E testing labels Jun 2, 2025
Copy link
Contributor

github-actions bot commented Jun 2, 2025

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 65513d4
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/3b9087f8-955a-44e8-a8c0-7c0e199b1328

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@adonesky1 adonesky1 added this pull request to the merge queue Jun 2, 2025
Merged via the queue into main with commit 8d220b8 Jun 2, 2025
44 of 52 checks passed
@adonesky1 adonesky1 deleted the jl/sip-26-multichain-router-solana-accountChanged branch June 2, 2025 21:05
@github-actions github-actions bot locked and limited conversation to collaborators Jun 2, 2025
@metamaskbot metamaskbot added the release-7.48.0 Issue or pull request that will be included in release 7.48.0 label Jun 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-7.48.0 Issue or pull request that will be included in release 7.48.0 Run Smoke E2E Requires smoke E2E testing skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. team-wallet-api-platform
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants