Skip to content

Commit a25c9a1

Browse files
committed
Document mobile deeplinks
1 parent f33eb02 commit a25c9a1

File tree

2 files changed

+181
-0
lines changed

2 files changed

+181
-0
lines changed

sdk-sidebar.js

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

sdk/guides/use-deeplinks.md

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

0 commit comments

Comments
 (0)