원클릭으로
migrate-wagmi-metamask-connector
Migrate a wagmi app from @metamask/sdk to the new @metamask/connect-evm connector (wagmi PR
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Migrate a wagmi app from @metamask/sdk to the new @metamask/connect-evm connector (wagmi PR
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Migrate from @metamask/sdk to @metamask/connect-evm, @metamask/connect-multichain, and @metamask/connect-solana with step-by-step package, API, and configuration changes
Build and send a Solana transaction using MetaMask Connect. Covers both the React wallet-adapter approach (sendTransaction) and the vanilla browser approach (signAndSendTransaction wallet-standard feature).
Scaffold a vanilla JS/TS browser app with MetaMask EVM integration using createEVMClient, EIP-1193 provider event listeners, RPC methods, and chain switching with chainConfiguration fallback
Scaffold a React app with MetaMask EVM integration using createEVMClient, useState/useEffect/useRef patterns, provider.request calls, chain switching, and error handling
Set up a multichain app using createMultichainClient from @metamask/connect-multichain. Covers EVM + Solana scopes, invokeMethod for both ecosystems, session events, headless mode, getInfuraRpcUrls, selective disconnect, and singleton behavior.
Set up a vanilla browser (non-React) app with @metamask/connect-solana using wallet-standard features directly. Use when integrating MetaMask Solana without a framework or wallet adapter library.
| name | migrate-wagmi-metamask-connector |
| description | Migrate a wagmi app from @metamask/sdk to the new @metamask/connect-evm connector (wagmi PR |
@wagmi/connectors v6.x/v7.x (which bundled @metamask/sdk) to v8.x+ / wagmi >= 3.6 (which uses @metamask/connect-evm)Cannot find module '@metamask/sdk' after updating wagmiThe MetaMask connector in wagmi has been completely rewritten. The underlying SDK changed from @metamask/sdk to @metamask/connect-evm. The connector now dynamically imports @metamask/connect-evm instead of bundling @metamask/sdk.
Key impacts:
@metamask/connect-evm must be installed explicitly, at a version inside wagmi's declared peer range (check npm info @wagmi/connectors peerDependencies — currently ^1.3.0)@metamask/sdk should be removeddappMetadata → dapp, useDeeplink → mobile.useDeeplink)SDKProvider to EIP1193ProviderRemove the old SDK and install the new one:
# npm
npm uninstall @metamask/sdk
npm install @metamask/connect-evm
# pnpm
pnpm remove @metamask/sdk
pnpm add @metamask/connect-evm
# yarn
yarn remove @metamask/sdk
yarn add @metamask/connect-evm
Then update wagmi packages to the latest:
npm install wagmi@latest @wagmi/core@latest @wagmi/connectors@latest
@metamask/sdk options):import { metaMask } from 'wagmi/connectors'
metaMask({
dappMetadata: {
name: 'My Dapp',
url: 'https://mydapp.com',
},
useDeeplink: true,
logging: { sdk: false },
// These SDK-specific options are REMOVED:
forceDeleteProvider: false,
forceInjectProvider: false,
injectProvider: false,
})
@metamask/connect-evm options):import { metaMask } from 'wagmi/connectors'
metaMask({
dapp: {
name: 'My Dapp',
url: 'https://mydapp.com',
iconUrl: 'https://mydapp.com/icon.png', // new optional field
},
debug: false,
// Mobile options are now nested:
mobile: {
useDeeplink: true,
preferredOpenLink: undefined, // required for React Native
},
})
Old Parameter (@metamask/sdk) | New Parameter (@metamask/connect-evm) | Notes |
|---|---|---|
dappMetadata: { name, url } | dapp: { name, url, iconUrl } | dappMetadata still works but is deprecated |
logging: { sdk: true } | debug: true | logging still works but is deprecated |
useDeeplink: boolean | mobile: { useDeeplink: boolean } | Moved into mobile namespace |
preferredOpenLink | mobile: { preferredOpenLink } | Moved into mobile namespace |
forceDeleteProvider | (removed) | No replacement — not needed with new SDK |
forceInjectProvider | (removed) | No replacement — not needed with new SDK |
injectProvider | (removed) | No replacement — not needed with new SDK |
readonlyRPCMap | (auto-configured) | Built automatically from wagmi's chain config |
_source | (auto-set to 'wagmi') | Set internally by the connector |
The connectAndSign parameter name changed from msg to message internally. However, at the wagmi connector level the API is the same — you still pass connectAndSign: 'message string' in the metaMask() parameters.
// Still works the same at the wagmi config level:
metaMask({
dapp: { name: 'My Dapp' },
connectAndSign: 'Please sign this message to verify your identity',
})
The connectWith API is also unchanged at the wagmi level:
metaMask({
dapp: { name: 'My Dapp' },
connectWith: {
method: 'eth_signTypedData_v4',
params: [address, typedData],
},
})
If your code directly accesses the provider from the connector, the type has changed:
// Before: provider was SDKProvider from @metamask/sdk
// After: provider is EIP1193Provider from @metamask/connect-evm
// The EIP1193Provider interface is the same standard interface,
// so provider.request() calls remain unchanged.
// New: You can access the underlying MetamaskConnectEVM instance:
const connector = config.connectors.find(c => c.id === 'metaMaskSDK')
if (connector) {
const instance = await connector.getInstance()
// instance.accounts, instance.getChainId(), instance.switchChain(), etc.
}
The new connector handles event listeners internally. If you had code that manually managed MetaMask SDK event listeners, you can remove it:
// REMOVE any manual SDK event management like:
// sdk.on('accountsChanged', ...)
// sdk.on('chainChanged', ...)
// provider.removeListener(...)
// Event handlers are now passed to createEVMClient internally.
// Wagmi hooks (useAccount, useChainId, etc.) handle state automatically.
This wagmi release also includes several API renames. Deprecated aliases are provided but you should migrate:
| Old API | New API | Package |
|---|---|---|
useAccount() | useConnection() | wagmi |
useAccountEffect() | useConnectionEffect() | wagmi |
useSwitchAccount() | useSwitchConnection() | wagmi |
getAccount() | getConnection() | @wagmi/core |
switchAccount() | switchConnection() | @wagmi/core |
watchAccount() | watchConnection() | @wagmi/core |
WagmiConfig | WagmiProvider | wagmi (alias removed) |
useToken() | useReadContracts() | wagmi (hook removed) |
useFeeData() | useEstimateFeesPerGas() | wagmi (alias removed) |
normalizeChainId() | (removed) | wagmi (export removed) |
After making changes, verify:
npm run build or tsc --noEmit should pass@metamask/sdk imports remain — search your codebase:
grep -r "@metamask/sdk" --include="*.ts" --include="*.tsx" --include="*.js"
@wagmi/connectors <= 7.x + @metamask/sdk):import { createConfig, http } from 'wagmi'
import { mainnet, sepolia, optimism } from 'wagmi/chains'
import { metaMask } from 'wagmi/connectors'
export const config = createConfig({
chains: [mainnet, sepolia, optimism],
connectors: [
metaMask({
dappMetadata: {
name: 'My Dapp',
url: window.location.origin,
},
useDeeplink: true,
}),
],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
[optimism.id]: http(),
},
})
@wagmi/connectors >= 8 + @metamask/connect-evm):import { createConfig, http } from 'wagmi'
import { mainnet, sepolia, optimism } from 'wagmi/chains'
import { metaMask } from 'wagmi/connectors'
export const config = createConfig({
chains: [mainnet, sepolia, optimism],
connectors: [
metaMask({
dapp: {
name: 'My Dapp',
url: window.location.origin,
},
mobile: {
useDeeplink: true,
},
}),
],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
[optimism.id]: http(),
},
})
If you are using wagmi with React Native, the preferredOpenLink callback has moved:
// Before:
metaMask({
dappMetadata: { name: 'My RN App' },
preferredOpenLink: (link, target) => Linking.openURL(link),
useDeeplink: true,
})
// After:
metaMask({
dapp: { name: 'My RN App' },
mobile: {
preferredOpenLink: (link, target) => Linking.openURL(link),
useDeeplink: true,
},
})
@metamask/connect-evm is an optional peer dependency of @wagmi/connectors — you only need it if you use the metaMask() connector'metaMaskSDK' and the name remains 'MetaMask' — no changes to connector identityrdns is ['io.metamask', 'io.metamask.mobile'] — unchangedsupportedNetworks map is now auto-built from wagmi's configured chains and their default RPC URLs — you no longer need to pass readonlyRPCMapdappMetadata parameter still works (it's mapped to dapp internally) but is deprecated — migrate to dapp for forward compatibilitylogging parameter still works (mapped to debug: true) but is deprecateddapp config is provided, the connector defaults to { name: window.location.hostname, url: window.location.href } in browsers, or { name: 'wagmi' } in Node.js/SSR