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

DRAFT: SIP-26 Integration #29887

Draft
wants to merge 40 commits into
base: jl/caip-multichain-migrate-core
Choose a base branch
from
Draft

DRAFT: SIP-26 Integration #29887

wants to merge 40 commits into from

Conversation

jiexi
Copy link
Contributor

@jiexi jiexi commented Jan 23, 2025

Open in GitHub Codespaces

Steps to get manual testing environment setup:

  • start a flask build of this branch yarn start:flask
  • go to settings -> experimental
  • toggle on Enable "Add a new Bitcoin account (Beta)"
  • go to the accounts drop down at the top of the wallet, and click add an account
  • you should see an option to add a bitcoin account now. Add a bitcoin account
  • Go to https://metamask.github.io/test-dapp-multichain/latest/ (or any website)
  • Execute the following code in the dev console
const extensionPort = chrome.runtime.connect(YOUR_EXTENSION_ID)
extensionPort.onMessage.addListener((msg) => {
    console.log(msg.data)
})


extensionPort.postMessage({
    type: 'caip-x',
    data: {
        "jsonrpc": "2.0",
        method: 'wallet_createSession',
        params: {
            requiredScopes: {},
            optionalScopes: {
                'bip122:000000000019d6689c085ae165831e93': {
                    methods: ['sendBitcoin'],
                    notifications: [],
                    accounts: []
                }
            },
        },
    }
})

extensionPort.postMessage({
    type: 'caip-x',
    data: {
        "jsonrpc": "2.0",
        method: 'wallet_invokeMethod',
  "params": {
    "scope": "bip122:000000000019d6689c085ae165831e93",
    "request": {
      "method": "sendBitcoin",
      "params": {
        recipients: {
          address: '0.1',
        },
        replaceable: true,
      }
    }
}}})

Related issues

Ticket: https://github.com/orgs/MetaMask/projects/146/views/6?pane=issue&itemId=94617458&issue=MetaMask%7CMetaMask-planning%7C3989
Upstream Extension: #27782
Core: MetaMask/core#5191

Manual testing steps

  1. Go to this page...

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

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.

@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Jan 24, 2025
jiexi added 19 commits January 24, 2025 08:26
# Conflicts:
#	app/scripts/lib/rpc-method-middleware/handlers/wallet-createSession/handler.ts
#	app/scripts/metamask-controller.js
@jiexi
Copy link
Contributor Author

jiexi commented Feb 5, 2025

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated.
👀 Please review the diff for suspicious new powers.

🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff

Copy link

socket-security bot commented Feb 11, 2025

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report↗︎

@jiexi
Copy link
Contributor Author

jiexi commented Feb 11, 2025

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated.
👀 Please review the diff for suspicious new powers.

🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff

@metamaskbot
Copy link
Collaborator

❌ API Spec Test Failed. View the report here.

@metamaskbot
Copy link
Collaborator

❌ Multichain API Spec Test Failed. View the report here.

@metamaskbot
Copy link
Collaborator

❌ API Spec Test Failed. View the report here.

@metamaskbot
Copy link
Collaborator

❌ Multichain API Spec Test Failed. View the report here.

@mcmire
Copy link
Contributor

mcmire commented Mar 6, 2025

A couple of notes:

  • The Bitcoin integration was disabled in chore(bitcoin): add bitcoin build feature + disable it temporarily #30477, so we have to use the Solana integration for testing. I think this could work:

    const extensionPort = chrome.runtime.connect(YOUR_EXTENSION_ID)
    
    extensionPort.onMessage.addListener((msg) => {
      console.log(msg.data)
    })
    
    extensionPort.postMessage({
      type: "caip-x",
      data: {
        jsonrpc: "2.0",
        method: "wallet_createSession",
        params: {
          requiredScopes: {},
          optionalScopes: {
            "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": {
              methods: ["getAccount"],
              notifications: [],
              accounts: []
            }
          },
        },
      }
    })
    
    extensionPort.postMessage({
      type: "caip-x",
      data: {
        jsonrpc: "2.0",
        method: "wallet_invokeMethod",
        params: {
          scope: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
          request: {
            method: "getAccount",
            params: [YOUR_SOLANA_ACCOUNT_ID]
          }
        }
      }
    })
  • However, the above does not work, and in fact, the new changes introduced in this PR are breaking createSession, getSession, etc. I'm not sure why, I'll have to investigate.

Copy link

socket-security bot commented Mar 6, 2025

Updated dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@metamask/[email protected]4.0.0 None 0 672 kB metamaskbot

View full report↗︎

@metamaskbot
Copy link
Collaborator

Builds ready [552e273]
Page Load Metrics (1671 ± 105 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint153323391676218104
domContentLoaded150822901645216104
load153223471671219105
domInteractive259539189
backgroundConnect126232157
firstReactRender1465342211
getState5471094
initialActions01000
loadScripts10821805122619594
setupStore712811
uiStartup169725451880215103

@metamaskbot
Copy link
Collaborator

Builds ready [c6b5bc7]
Page Load Metrics (1912 ± 62 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint39821501749459221
domContentLoaded17232086185010752
load17512190191212962
domInteractive257536147
backgroundConnect13191635828
firstReactRender1673382211
getState6141394120
initialActions01000
loadScripts1295159113988239
setupStore860292010
uiStartup201231842326359172

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
INVALID-PR-TEMPLATE PR's body doesn't match template team-wallet-api-platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants