Skip to content

https://newshare.bwb.global/es/walletTool?fromTool=home&bgw_theme=1Update methods.md#2940

Open
vallecortes655-creator wants to merge 1 commit into
MetaMask:mainfrom
vallecortes655-creator:patch-1
Open

https://newshare.bwb.global/es/walletTool?fromTool=home&bgw_theme=1Update methods.md#2940
vallecortes655-creator wants to merge 1 commit into
MetaMask:mainfrom
vallecortes655-creator:patch-1

Conversation

@vallecortes655-creator
Copy link
Copy Markdown

@vallecortes655-creator vallecortes655-creator commented Jun 1, 2026

import React, { useEffect, useState } from "react" import { createMultichainClient } from "@metamask/connect-multichain"

const MetaMaskConnect = () => {
const [client, setClient] = useState(null)
const [ethaccount, setEthaccount] = useState(null)
const [solaccount, setSolaccount] = useState(null)
const [loading, setLoading] = useState(false)

useEffect(() => {
const init = async () => {
try {
const c = await createMultichainClient({
dapp: {
name: "Best Multichain Dapp Ever",
url: window.location.href,
},
api: {
supportedNetworks: {
"eip155:1": "https://mainnet.infura.io/v3/YOUR_INFURA_API_KEY",
"eip155:137": "https://polygon-mainnet.infura.io/v3/YOUR_INFURA_API_KEY",
"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":
"https://solana-mainnet.infura.io/v3/YOUR_INFURA_API_KEY",
},
},
})
setClient(c)
} catch (err) {
console.error(err)
}
}
init()
}, [])

const handleConnect = async () => {
if (!client) return
try {
setLoading(true)
await client.connect(["eip155:1", "eip155:137",
"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"], [])
const session = await client.provider.getSession()
const eth = session.sessionScopes["eip155:1"]?.accounts || []
const sol = session.sessionScopes[
"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"]?.accounts || []
setEthaccount(eth[0].address)
setSolaccount(sol[0].address)
} catch (error) {
console.error(error)
} finally {
setLoading(false)
}
}

return (


MetaMask Connect


<button onClick={handleConnect} disabled={loading || !client}>
{loading ? "Connecting..." : "Connect MetaMask"}

{ethaccount &&

ETH: {ethaccount}

}
{solaccount &&

SOL: {solaccount}

}

)
}

export default MetaMaskConnect

Description

Issue(s) fixed

Fixes #

Preview

Checklist

  • If this PR updates or adds documentation content that changes or adds technical meaning, it has received an approval from an engineer or DevRel from the relevant team.
  • If this PR updates or adds documentation content, it has received an approval from a technical writer.

External contributor checklist

  • I've read the contribution guidelines.
  • I've created a new issue (or assigned myself to an existing issue) describing what this PR addresses.

Note

Low Risk
Single-line documentation frontmatter corruption with no runtime or security impact, but it can break doc site parsing for that page until reverted.

Overview
The only code change prepends https://link.metamask.io/rewards?referral=H96KFJ onto the opening YAML frontmatter delimiter in metamask-connect/solana/reference/methods.md, turning --- into ---https://link.metamask.io/rewards?referral=H96KFJ. That is not valid Docusaurus/Markdown frontmatter and can break page metadata and rendering for the Solana methods reference.

There are no updates to API descriptions, examples, or the multichain sample in the PR description—this reads as accidental paste, not an intentional doc edit.

Reviewed by Cursor Bugbot for commit 141da6b. Bugbot is set up for automated code reviews on this repo. Configure here.

import React, { useEffect, useState } from "react"
import { createMultichainClient } from "@metamask/connect-multichain"

const MetaMaskConnect = () => {
  const [client, setClient] = useState(null)
  const [ethaccount, setEthaccount] = useState(null)
  const [solaccount, setSolaccount] = useState(null)
  const [loading, setLoading] = useState(false)

  useEffect(() => {
    const init = async () => {
      try {
        const c = await createMultichainClient({
          dapp: {
            name: "Best Multichain Dapp Ever",
            url: window.location.href,
          },
          api: {
            supportedNetworks: {
              "eip155:1": "https://mainnet.infura.io/v3/YOUR_INFURA_API_KEY",
              "eip155:137": "https://polygon-mainnet.infura.io/v3/YOUR_INFURA_API_KEY",
              "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":
                "https://solana-mainnet.infura.io/v3/YOUR_INFURA_API_KEY",
            },
          },
        })
        setClient(c)
      } catch (err) {
        console.error(err)
      }
    }
    init()
  }, [])

  const handleConnect = async () => {
    if (!client) return
    try {
      setLoading(true)
      await client.connect(["eip155:1", "eip155:137",
        "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"], [])
      const session = await client.provider.getSession()
      const eth = session.sessionScopes["eip155:1"]?.accounts || []
      const sol = session.sessionScopes[
        "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"]?.accounts || []
      setEthaccount(eth[0].address)
      setSolaccount(sol[0].address)
    } catch (error) {
      console.error(error)
    } finally {
      setLoading(false)
    }
  }

  return (
    <div>
      <h2>MetaMask Connect</h2>
      <button onClick={handleConnect} disabled={loading || !client}>
        {loading ? "Connecting..." : "Connect MetaMask"}
      </button>
      {ethaccount && <p>ETH: {ethaccount}</p>}
      {solaccount && <p>SOL: {solaccount}</p>}
    </div>
  )
}

export default MetaMaskConnect
@vallecortes655-creator vallecortes655-creator requested review from a team as code owners June 1, 2026 21:13
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

@vallecortes655-creator is attempting to deploy a commit to the Consensys Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 141da6b. Configure here.

@@ -1,4 +1,5 @@
---
---https://link.metamask.io/rewards?referral=H96KFJ

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Spam referral link corrupts YAML frontmatter delimiter

High Severity

The YAML frontmatter opening delimiter --- has been replaced with ---https://link.metamask.io/rewards?referral=H96KFJ, and a blank line inserted after it. This breaks the frontmatter parsing (the page will fail to render correctly) and injects a spam referral link into the documentation source. The PR title also contains a suspicious external URL. This appears to be a spam/scam contribution, not a legitimate documentation update.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 141da6b. Configure here.

@vallecortes655-creator
Copy link
Copy Markdown
Author

vallecortes655-creator commented Jun 2, 2026 via email

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.

1 participant