Skip to content

Commit 9c6ffc4

Browse files
Document mobile deeplinks (#1928)
* Document mobile deeplinks * Apply suggestions from code review Co-authored-by: Byron Gravenorst <[email protected]> * update what's new * mention qr codes * update deeplinks --------- Co-authored-by: Byron Gravenorst <[email protected]>
1 parent 34a19cf commit 9c6ffc4

File tree

3 files changed

+184
-0
lines changed

3 files changed

+184
-0
lines changed

docs/whats-new.md

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ of the [MetaMask developer page](https://metamask.io/developer/).
1111

1212
## April 2025
1313

14+
- Documented [how to use deeplinks](/sdk/guides/use-deeplinks).
15+
([#1928](https://github.com/MetaMask/metamask-docs/pull/1928))
1416
- Documented [MetaMask SDK + Dynamic SDK integration](/sdk/quickstart/javascript-dynamic).
1517
([#1972](https://github.com/MetaMask/metamask-docs/pull/1972))
1618
- Documented [Snaps bundle analyzer option](/snaps/reference/cli/subcommands/#analyze).

sdk-sidebar.js

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const sidebar = {
4242
'guides/manage-networks',
4343
'guides/handle-transactions',
4444
'guides/interact-with-contracts',
45+
'guides/use-deeplinks',
4546
{
4647
type: 'category',
4748
label: 'Advanced',

sdk/guides/use-deeplinks.md

+181
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
---
2+
description: Use deeplinks to connect to users' mobile wallets.
3+
toc_max_heading_level: 2
4+
---
5+
6+
import Tabs from "@theme/Tabs";
7+
import TabItem from "@theme/TabItem";
8+
9+
# Use deeplinks
10+
11+
You can use deeplinks to directly route your users to specific, pre-configured functions inside the MetaMask Mobile app.
12+
For example, you can create a deeplink that lets users make one-click payments with a preset token, recipient, and amount.
13+
You can also convert deeplinks to QR codes, so users can scan them with a mobile device.
14+
15+
If a user doesn't have MetaMask Mobile installed, deeplinks route the user to a landing page where they can download the app.
16+
17+
This page highlights deeplinks available for MetaMask Mobile.
18+
19+
## Open a dapp inside the in-app browser
20+
21+
<Tabs>
22+
<TabItem value="Deeplink">
23+
24+
```text
25+
https://metamask.app.link/dapp/{dappUrl}
26+
```
27+
28+
</TabItem>
29+
<TabItem value="Example">
30+
31+
```text
32+
https://metamask.app.link/dapp/app.uniswap.org
33+
```
34+
35+
</TabItem>
36+
</Tabs>
37+
38+
39+
This deeplink takes the user directly to the dapp URL in the MetaMask Mobile in-app browser.
40+
41+
The example navigates to `app.uniswap.org` in the in-app browser.
42+
43+
### Path parameters
44+
45+
- `dappUrl` - Dapp URL.
46+
47+
## Send native currency
48+
49+
<Tabs>
50+
<TabItem value="Deeplink">
51+
52+
```text
53+
https://metamask.app.link/send/{recipient}@{chainId}
54+
```
55+
56+
</TabItem>
57+
<TabItem value="Example">
58+
59+
```text
60+
https://metamask.app.link/send/0x0000000@137?value=1e16
61+
```
62+
63+
</TabItem>
64+
</Tabs>
65+
66+
This deeplink starts the process of sending a transaction in the native currency.
67+
If the chain ID is specified, MetaMask Mobile automatically switches to the correct network.
68+
69+
The example displays the confirmation screen to send 0.01 POL (`1e16` wei) in Polygon (chain ID `137`) to recipient address `0x0000000`.
70+
71+
### Path parameters
72+
73+
- `recipient` - Address of the recipient.
74+
- `chainId` - (Optional) Chain ID of the network to use.
75+
76+
### Query string parameters
77+
78+
- `value` - Amount to be transferred, in the native currency's smallest unit.
79+
80+
## Send an ERC-20 token
81+
82+
<Tabs>
83+
<TabItem value="Deeplink">
84+
85+
```text
86+
https://metamask.app.link/send/{contractAddress}@{chainId}/transfer
87+
```
88+
89+
</TabItem>
90+
<TabItem value="Example">
91+
92+
```text
93+
https://metamask.app.link/send/0x176211869cA2b568f2A7D4EE941E073a821EE1ff@59144/transfer?address=0x0000000&uint256=1e6
94+
```
95+
96+
</TabItem>
97+
</Tabs>
98+
99+
This deeplink starts the process of sending a transaction in an ERC-20 token.
100+
If the chain ID is specified, MetaMask Mobile automatically switches to the correct network.
101+
102+
The example displays the confirmation screen to send 1 USDC (`1e6` units, contract address `0x176211869cA2b568f2A7D4EE941E073a821EE1ff`) on Linea (chain ID `59144`) to recipient address `0x0000000`.
103+
104+
### Path parameters
105+
106+
- `contractAddress` - Contract address of the ERC-20 token.
107+
- `chainId` - (Optional) Chain ID of the network to use.
108+
109+
### Query string parameters
110+
111+
- `address` - Address of the recipient.
112+
- `uint256` - Amount to be transferred, in the token's smallest unit.
113+
114+
## Start the on-ramp process
115+
116+
<Tabs>
117+
<TabItem value="Deeplink">
118+
119+
```text
120+
https://metamask.app.link/buy
121+
```
122+
123+
</TabItem>
124+
<TabItem value="Example">
125+
126+
```text
127+
https://metamask.app.link/buy?chainId=59144&address=0x176211869cA2b568f2A7D4EE941E073a821EE1ff&amount=100
128+
```
129+
130+
</TabItem>
131+
</Tabs>
132+
133+
This deeplink starts the on-ramp process to buy native currency or ERC-20 tokens.
134+
If the chain ID is specified, MetaMask Mobile automatically switches to the correct network.
135+
136+
The example starts the on-ramp process to buy $100 (`amount=100`) of USDC (contract address `0x176211869cA2b568f2A7D4EE941E073a821EE1ff`) on Linea (chain ID `59144`).
137+
The fiat currency depends on the onboarding status of the user and the region they select.
138+
139+
:::note
140+
You can use the `/buy` or `/buy-crypto` path for this deeplink.
141+
:::
142+
143+
### Query string parameters
144+
145+
- `chainId` - (Optional) Chain ID of the network to use.
146+
- `address` - (Optional) Contract address of the ERC-20 token.
147+
If omitted, the native currency is used.
148+
- `amount` - (Optional) Amount to buy, in the user's fiat currency.
149+
150+
## Start the off-ramp process
151+
152+
<Tabs>
153+
<TabItem value="Deeplink">
154+
155+
```text
156+
https://metamask.app.link/sell
157+
```
158+
159+
</TabItem>
160+
<TabItem value="Example">
161+
162+
```text
163+
https://metamask.app.link/sell?chainId=59144&amount=125
164+
```
165+
166+
</TabItem>
167+
</Tabs>
168+
169+
This deeplink starts the off-ramp process to sell native currency.
170+
If the chain ID is specified, MetaMask Mobile automatically switches to the correct network.
171+
172+
The example starts the off-ramp process to sell 125 ETH (`amount=125`) on Linea (chain ID `59144`).
173+
174+
:::note
175+
You can use the `/sell` or `/sell-crypto` path for this deeplink.
176+
:::
177+
178+
### Query string parameters
179+
180+
- `chainId` - (Optional) Chain ID of the network to use.
181+
- `amount` - (Optional) Amount to sell, in the native currency.

0 commit comments

Comments
 (0)