Skip to content

Commit 5c7a605

Browse files
committed
Docs: update multichain peer-dep and Solana APIs
Remove guidance to explicitly install @metamask/connect-multichain for single-ecosystem packages and simplify install commands across EVM and Solana quickstarts. Rename Solana methods and Wallet Standard features (solana_signMessage → signMessage, solana_signAndSendTransaction/signAndSendAllTransactions → signAndSendTransaction) and update batch guidance to use the variadic signAndSendTransaction call. Revise error handling docs to use the new multichain error classes (RPCInvokeMethodErr, RPCHttpErr, RPCReadonlyResponseErr, RPCReadonlyRequestErr) and expose wallet RPC codes on err.rpcCode; remove the internal transport 1013 note from provider docs. Misc: update Wagmi quickstart to require @metamask/connect-evm@^2.1.0 and adjust examples/usages across multichain, evm, solana, reference, and troubleshooting pages to match the new APIs and patterns.
1 parent 905da0e commit 5c7a605

23 files changed

Lines changed: 152 additions & 164 deletions

File tree

metamask-connect/evm/guides/migrate-from-sdk.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ npm uninstall @metamask/sdk
4444
# For React Native, remove
4545
npm uninstall @metamask/sdk-react
4646

47-
# Install new (EVM). @metamask/connect-multichain is a required peer dependency since @metamask/connect-evm 2.0.0.
48-
npm install @metamask/connect-evm @metamask/connect-multichain
47+
# Install new (EVM only)
48+
npm install @metamask/connect-evm
4949
```
5050

5151
### 2. Update imports
@@ -346,10 +346,6 @@ If your dapp supports (or plans to support) both EVM and Solana, consider upgrad
346346
The EVM client is built on top of `createMultichainClient` internally, so the upgrade is
347347
straightforward:
348348

349-
```bash npm2yarn
350-
npm install @metamask/connect-multichain
351-
```
352-
353349
```typescript
354350
import { createMultichainClient } from '@metamask/connect-multichain'
355351

metamask-connect/evm/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ We recommend using an Infura API key for production dapps. MetaMask Connect EVM
9999

100100
To migrate:
101101

102-
- Replace `@metamask/sdk` with `@metamask/connect-evm` in your dependencies, and add `@metamask/connect-multichain` (a required peer dependency since `@metamask/connect-evm` 2.0.0).
102+
- Replace `@metamask/sdk` with `@metamask/connect-evm` in your dependencies.
103103
- Update imports from `MetaMaskSDK` to `createEVMClient`.
104104
- Switch from synchronous to async initialization.
105105
- Update your provider access pattern.

metamask-connect/evm/quickstart/javascript.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,9 @@ You've successfully set up MetaMask Connect EVM.
125125
Install the EVM client in an existing JavaScript project:
126126

127127
```bash npm2yarn
128-
npm install @metamask/connect-evm @metamask/connect-multichain
128+
npm install @metamask/connect-evm
129129
```
130130

131-
:::note
132-
Since `@metamask/connect-evm` 2.0.0, `@metamask/connect-multichain` is a required peer dependency that you must install explicitly.
133-
:::
134-
135131
### 2. Initialize MetaMask Connect EVM
136132

137133
Initialize the EVM client using [`createEVMClient`](../reference/methods.md#createevmclient).

metamask-connect/evm/quickstart/nodejs.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,9 @@ polyfilling in browser or React Native environments.
4242
Install the EVM client in an existing Node.js project:
4343

4444
```bash npm2yarn
45-
npm install @metamask/connect-evm @metamask/connect-multichain
45+
npm install @metamask/connect-evm
4646
```
4747

48-
:::note
49-
Since `@metamask/connect-evm` 2.0.0, `@metamask/connect-multichain` is a required peer dependency that you must install explicitly.
50-
:::
51-
5248
### 2. Initialize MetaMask Connect EVM
5349

5450
Create a file (`index.mjs`) and initialize the client using [`createEVMClient`](../reference/methods.md#createevmclient).

metamask-connect/evm/quickstart/react-native.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,9 @@ npx create-expo-app MyProject --template
5555
Install MetaMask Connect EVM and its required polyfill packages:
5656

5757
```bash
58-
npm install @metamask/connect-evm @metamask/connect-multichain react-native-get-random-values buffer @react-native-async-storage/async-storage readable-stream
58+
npm install @metamask/connect-evm react-native-get-random-values buffer @react-native-async-storage/async-storage readable-stream
5959
```
6060

61-
:::note
62-
Since `@metamask/connect-evm` 2.0.0, `@metamask/connect-multichain` is a required peer dependency that you must install explicitly.
63-
:::
64-
6561
### 3. Create polyfills
6662

6763
Create `polyfills.ts` (at the project root or in `src/`) with all required global shims.

metamask-connect/evm/quickstart/wagmi.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ TOD0: Update with new screenshot and link
9797
Install MetaMask Connect EVM along with its peer dependencies to an existing React project:
9898

9999
:::note Version requirements
100-
This quickstart requires `wagmi@^3.6.0`. The `metaMask` connector is imported from the `wagmi/connectors` subpath (part of the `wagmi` package), and requires `@metamask/connect-evm`, which in turn requires `@metamask/connect-multichain` as a peer dependency.
100+
This quickstart requires `wagmi@^3.6.0`. The `metaMask` connector is imported from the `wagmi/connectors` subpath (part of the `wagmi` package) and requires `@metamask/connect-evm@^2.1.0`.
101101
:::
102102

103103
```bash npm2yarn
104-
npm install @metamask/connect-evm @metamask/connect-multichain wagmi@^3.6.0 viem@2.x @tanstack/react-query
104+
npm install @metamask/connect-evm@^2.1.0 wagmi@^3.6.0 viem@2.x @tanstack/react-query
105105
```
106106

107107
### 2. Import required dependencies
@@ -320,7 +320,7 @@ If you previously used `@metamask/sdk` with Wagmi, the MetaMask connector now us
320320
321321
```bash npm2yarn
322322
npm uninstall @metamask/sdk
323-
npm install @metamask/connect-evm @metamask/connect-multichain wagmi@^3.6.0
323+
npm install @metamask/connect-evm@^2.1.0 wagmi@^3.6.0
324324
```
325325
326326
2. Update hook usage for wagmi v3:

metamask-connect/evm/reference/provider-api.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ Common codes and their meaning include:
338338
- `4902` - The chain isn't recognized by the wallet. Add it with `wallet_addEthereumChain`, or pass `chainConfiguration` to [`switchChain`](methods.md#switchchain).
339339
- `-32602` - The parameters are invalid.
340340
- `-32603` - Internal error.
341-
- `1013` - An internal transport disconnect. The SDK retries automatically, so don't treat it as a user-facing disconnect.
342341

343342
For the complete list of errors, see [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193#provider-errors)
344343
and [EIP-1474](https://eips.ethereum.org/EIPS/eip-1474#error-codes).
@@ -349,8 +348,11 @@ returned by the MetaMask provider, and can help you identify their meaning.
349348
:::
350349

351350
:::note Typed errors
352-
The multichain core exports typed error classes for `instanceof` checks: `ProtocolError`,
353-
`StorageError`, and `RpcError` from `@metamask/connect-multichain`.
351+
When you use the multichain client, the core (`@metamask/connect-multichain`) exports typed error
352+
classes for `instanceof` checks: `RPCInvokeMethodErr` (wraps wallet `invokeMethod` errors—read the
353+
wallet's original code from `err.rpcCode`), `RPCHttpErr`, `RPCReadonlyResponseErr`, and
354+
`RPCReadonlyRequestErr`. The EVM provider itself rejects with a standard EIP-1193 `ProviderRpcError`
355+
(use `err.code`).
354356
:::
355357

356358
## Next steps

metamask-connect/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ See [supported platforms](supported-platforms.md) for the full matrix.
9696
### Which blockchain networks does MetaMask Connect support?
9797

9898
MetaMask Connect supports Ethereum and all EVM-compatible networks (Polygon, Arbitrum, Optimism, Linea, Base, etc.) through `@metamask/connect-evm`, Solana through `@metamask/connect-solana`, and both simultaneously through `@metamask/connect-multichain`.
99-
Since their 2.0.0 releases, `@metamask/connect-evm` and `@metamask/connect-solana` require `@metamask/connect-multichain` as an explicitly installed peer dependency.
10099
See [integration options](integration-options.md) to choose the right package.
101100

102101
### Do I need an Infura API key to use MetaMask Connect?

metamask-connect/integration-options.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,6 @@ If your dapp supports both EVM and Solana, use [`@metamask/connect-evm`](evm/ind
5858
[`@metamask/connect-solana`](solana/index.mdx) together to
5959
support both ecosystems while keeping familiar provider interfaces for each.
6060

61-
:::note
62-
The `@metamask/connect-evm` and `@metamask/connect-solana` packages require
63-
`@metamask/connect-multichain` as an explicitly installed peer dependency since their 2.0.0 releases.
64-
Install it alongside whichever single-ecosystem package you use.
65-
:::
66-
6761
## Compare options
6862

6963
| | Multichain | Single-ecosystem | Multi-ecosystem |

metamask-connect/multichain/guides/send-transactions.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ console.log('Estimated gas:', gasEstimate)
133133

134134
## Build and send a Solana transaction
135135

136-
Build a transaction with `@solana/web3.js`, serialize it to base64, then send it with `solana_signAndSendTransaction`.
136+
Build a transaction with `@solana/web3.js`, serialize it to base64, then send it with `signAndSendTransaction`.
137137
This signs and broadcasts the transaction in one step:
138138

139139
```javascript
@@ -163,8 +163,9 @@ const base64Transaction = Buffer.from(serialized).toString('base64')
163163
const result = await client.invokeMethod({
164164
scope: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
165165
request: {
166-
method: 'solana_signAndSendTransaction',
166+
method: 'signAndSendTransaction',
167167
params: {
168+
account: { address: fromPubkey.toBase58() },
168169
transaction: base64Transaction,
169170
},
170171
},
@@ -174,15 +175,16 @@ console.log('SOL tx signature:', result.signature)
174175

175176
## Sign a Solana transaction without sending
176177

177-
Use `solana_signTransaction` to get the signed transaction back without broadcasting it.
178+
Use `signTransaction` to get the signed transaction back without broadcasting it.
178179
This is useful when you need to inspect or modify the signed output before submitting:
179180

180181
```javascript
181182
const signResult = await client.invokeMethod({
182183
scope: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
183184
request: {
184-
method: 'solana_signTransaction',
185+
method: 'signTransaction',
185186
params: {
187+
account: { address: fromPubkey.toBase58() },
186188
transaction: base64Transaction,
187189
},
188190
},
@@ -196,11 +198,10 @@ console.log('Transaction ID:', txId)
196198

197199
## Error handling
198200

199-
| Error code | Description | Action |
200-
| ---------- | ----------------------------- | -------------------------------------------------------------------------- |
201-
| `4001` | User rejected the request | Show a retry option. Do not treat as an application error. |
202-
| `-32002` | Request already pending | Wait for the user to respond in MetaMask before retrying. |
203-
| `1013` | Internal transport disconnect | The SDK retries automatically. Don't treat it as a user-facing disconnect. |
201+
| Error code | Description | Action |
202+
| ---------- | ------------------------- | ---------------------------------------------------------- |
203+
| `4001` | User rejected the request | Show a retry option. Do not treat as an application error. |
204+
| `-32002` | Request already pending | Wait for the user to respond in MetaMask before retrying. |
204205

205206
<br/>
206207

0 commit comments

Comments
 (0)