Skip to content

Commit 9eb222c

Browse files
Update MetaMask connector doc (#4425)
* Update MetaMask connector doc Update docs page for the MetaMask SDK connector. This includes removing several options that we don't recommend configuring. * Address reviewer comments * update link * fix dappMetadata description
1 parent e563ef6 commit 9eb222c

File tree

1 file changed

+28
-108
lines changed

1 file changed

+28
-108
lines changed

site/shared/connectors/metaMask.md

Lines changed: 28 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const connectorsPackageName = 'wagmi/connectors'
66

77
# metaMask
88

9-
Connector for the [MetaMask SDK](https://github.com/MetaMask/metamask-sdk).
9+
Connector for [MetaMask SDK](https://github.com/MetaMask/metamask-sdk).
1010

1111
## Import
1212

@@ -36,133 +36,53 @@ export const config = createConfig({
3636
```ts-vue
3737
import { type MetaMaskParameters } from '{{connectorsPackageName}}'
3838
```
39-
Check out the [MetaMask SDK docs](https://github.com/MetaMask/metamask-sdk?tab=readme-ov-file#sdk-options) for more info. A few options are omitted that Wagmi manages internally.
4039

41-
### communicationLayerPreference
42-
43-
`CommunicationLayerPreference | undefined`
44-
45-
The preferred communication layer to use for the SDK.
46-
47-
### communicationServerUrl
48-
49-
`string | undefined`
50-
51-
The URL of the communication server to use for the SDK.
40+
Check out the [MetaMask SDK docs](https://docs.metamask.io/wallet/connect/3rd-party-libraries/wagmi/) for more info. A few options are omitted that Wagmi manages internally.
5241

5342
### dappMetadata
5443

5544
`DappMetadata | undefined`
5645

57-
- Metadata about the dapp using the SDK.
58-
- Defaults to `{ name: 'wagmi' }`.
59-
60-
### enableAnalytics
61-
62-
`boolean | undefined`
63-
64-
- Send anonymous analytics to MetaMask to help us improve the SDK.
65-
- Defaults to `false`.
66-
67-
### extensionOnly
68-
69-
`boolean | undefined`
70-
71-
- If MetaMask browser extension is detected, directly use it.
72-
- Defaults to `true`.
73-
74-
### forceDeleteProvider <Badge type="warning">deprecated</Badge>
75-
76-
`boolean | undefined`
77-
78-
If true, the SDK will force delete the provider from the global `window` object.
79-
80-
81-
### forceInjectProvider <Badge type="warning">deprecated</Badge>
82-
83-
`boolean | undefined`
84-
85-
If true, the SDK will force inject the provider into the global `window` object.
86-
87-
### infuraAPIKey
46+
Metadata about the dapp using the SDK, including, `name`, `url`, and `iconUrl`.
47+
By default, `url` gets its value from `window.location.origin`.
8848

89-
`string | undefined`
90-
91-
The Infura API key to use for RPC requests.
92-
93-
### injectProvider <Badge type="warning">deprecated</Badge>
94-
95-
`boolean | undefined`
49+
```ts-vue
50+
import { metaMask } from '{{connectorsPackageName}}'
9651
97-
If true, the SDK will inject the provider into the global `window` object.
52+
const connector = metaMask({
53+
dappMetadata: { // [!code focus]
54+
name: 'My Wagmi App', // [!code focus]
55+
url: 'https://example.com', // [!code focus]
56+
iconUrl: 'https://example.com/favicon.ico', // [!code focus]
57+
}
58+
})
59+
```
9860

9961
### logging
10062

10163
`SDKLoggingOptions | undefined`
10264

10365
Options for customizing the logging behavior of the SDK.
10466

105-
### modals
106-
107-
`RemoteConnectionProps['modals'] | undefined`
108-
109-
An object that allows you to customize or translate each of the displayed modals. See the nodejs example for more information.
110-
111-
### openDeeplink
112-
113-
`((arg: string) => void) | undefined`
114-
115-
A function that will be called to open a deeplink to the MetaMask Mobile app.
116-
117-
### preferDesktop
67+
### headless
11868

11969
`boolean | undefined`
12070

121-
If true, the SDK will prefer the desktop version of MetaMask over the mobile version.
122-
123-
### shouldShimWeb3
124-
125-
`boolean | undefined`
126-
127-
If true, the SDK will shim the window.web3 object with the provider returned by the SDK (useful for compatibility with older browser).
128-
129-
### storage
130-
131-
`StorageManagerProps | undefined`
132-
133-
Options for customizing the storage manager used by the SDK.
134-
135-
### timer
71+
Enables or disables headless mode.
72+
Setting this to `true` disables the MetaMask modal, allowing you to create your own UI.
73+
To get the deeplink to display in the QR code, listen to the `display_uri` event.
13674

137-
`any | undefined`
75+
The default is `false`.
13876

139-
A timer object to use for scheduling tasks.
140-
141-
### transports
142-
143-
`string[] | undefined`
144-
145-
An array of transport protocols to use for communication with the MetaMask wallet.
146-
147-
### ui
148-
149-
`SDKUIOptions | undefined`
150-
151-
Options for customizing the SDK UI.
152-
153-
### useDeeplink <Badge type="warning">deprecated</Badge>
154-
155-
`boolean | undefined`
156-
157-
- If `true`, the SDK will use deeplinks to connect with MetaMask Mobile. If `false`, the SDK will use universal links to connect with MetaMask Mobile.
158-
- Defaults to `true`.
159-
160-
::: warning
161-
Setting `useDeeplink` to `false` can negatively impact performance on iOS Safari as Universal Link connections are canceled if they do not occur within ~500ms of an interaction (e.g. button press).
162-
:::
77+
```ts-vue
78+
import { metaMask } from '{{connectorsPackageName}}'
16379
164-
### wakeLockType
80+
const connector = metaMask({
81+
headless: true // [!code focus]
82+
})
83+
```
16584

166-
`WakeLockStatus | undefined`
85+
## Advanced
16786

168-
The type of wake lock to use when the SDK is running in the background.
87+
By default, if the EIP-6963 MetaMask injected provider is detected, this connector will replace it.
88+
See the [`rdns` property](https://wagmi.sh/dev/creating-connectors#properties) for more information.

0 commit comments

Comments
 (0)