https://newshare.bwb.global/es/walletTool?fromTool=home&bgw_theme=1Update methods.md#2940
https://newshare.bwb.global/es/walletTool?fromTool=home&bgw_theme=1Update methods.md#2940vallecortes655-creator wants to merge 1 commit into
Conversation
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 is attempting to deploy a commit to the Consensys Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 141da6b. Configure here.
| @@ -1,4 +1,5 @@ | |||
| --- | |||
| ---https://link.metamask.io/rewards?referral=H96KFJ | |||
|
|
|||
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 141da6b. 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 (
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
External contributor checklist
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=H96KFJonto the opening YAML frontmatter delimiter inmetamask-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.