# Deep Linking

开发者可以通过 *DeepLink* 调用 imToken 应用，并将其打开到指定页面。无需第三方库或其他集成。

### 场景介绍

* 用户从各自的移动设备访问你的产品，在指定的链接中调用 imToken 移动应用，并跳转到转账或其他功能。
* 用户在移动浏览器中访问你的产品，并通过指定的链接进入 imToken 内的 DApp，以帮助他们执行更多的资产相关操作。
* 你需要提示用户查看代币市场信息，并引导用户通过链接打开 imToken 查看聚合市场信息。
* 你的应用没有集成收款功能，所以需要引导用户打开 imToken 应用开始快速付款。

{% hint style="info" %}
如果用户没有安装 imToken 应用，则需要下载并安装该应用才能正确触发 *DeepLink*。
{% endhint %}

{% hint style="success" %}
即使 imToken 应用处于锁屏、未登录或未开启状态，仍旧会自动跳转 (在当前事务完成后)。
{% endhint %}

## 快速开始

> 在开始之前，确保你有一个可以被移动设备访问的网页或移动应用。

imToken 的 *DeepLink* 由**固定的前缀**和**路径**组成，开发者只需要指定相应的路径名即可。

```
imtokenv2://navigate/AssetsTab
// prefix: imtokenv2://navigate/
// path: AssetsTab
```

在 Web 应用程序中，将此链接放在 `a` 标签的 `herf` 属性中会正确触发跳转，打开 imToken 应用首页。

```markup
<a href="imtokenv2://navigate/AssetsTab">打开 imToken</a>
```

### 参数

有些页面支持额外的 `query` 参数，所以可以通过添加 `query` 来指定着陆页面。打开指定的 DApp 是最常见的例子。

```
imtokenv2://navigate/DappView?url=https://fee.token.im/eth
```

如果 DApp 链接中包含需要被解析的字符串、或符号，则需要对 URL 进行预编码 (`encode`)：

```
// imtokenv2://navigate/DappView?url=https://domain/path//\\-name
// 应该编码为:
imtokenv2://navigate/DappView?url=https%3A%2F%2Fdomain%2Fpath%2F%2F%5C-name
```

## Wallet Connect 支持

imToken 应用支持连接标准 Wallet Connect URI，常见的 Wallet Connect URI 如下所示：

```
# Wallet Connect URI
wc:00e46b69-d0cc-4b3e-b6a2-cee442f97188@1?bridge=https%3A%2F%2Fbridge.walletconnect.org&key=91303dedf64285cbbaf9120f6e9d160a5c8aa3deb67017a3874cd272323f48ae
```

关于 Schema 定制方式，请参考 [协议标准](https://docs.walletconnect.org/tech-spec#requesting-connection)。如果你希望**唤起 imToken 应用**并触发此链接，则需要添加固定前缀 `imtokenv2://wc?uri=` 。

```
imtokenv2://wc?uri=wc:00e46b69-d0cc-4b3e-b6a2-cee442f97188@1?bridge=https%3A%2F%2Fbridge.walletconnect.org&key=91303dedf64285cbbaf9120f6e9d160a5c8aa3deb67017a3874cd272323f48ae�
```

## 验证

测试和验证 *DeepLink* 是否能正常触发对开发者有很大帮助，我们提供了一个在线工具。请用移动设备打开 [验证工具](https://token-deeplink.vercel.app/)，验证 *DeepLink* 的触发效果。

## 参考路由

以下是目前可安全使用的 DeepLink 路径，注意使用时需要添加前缀。

* `About` -- 关于我们页面
* `ProfileTab` -- 个人信息页面
* `DiscoveryTab`  -- 发现
* `MarketTab` -- 市场
* `MarketTab?tabIndex=<number>` -- 打开市场，并跳转至指定 Tab
* `AssetsTab` -- 应用主页，资产信息
* `DappView?url=<URL>`  -- 打开指定地址的 DApp
* `Tokenlon?makerSymbol=<symbol>&takerSymbol=<symbol>` -- 打开 Tokenlon 并且指定兑换对


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://imtoken.gitbook.io/developers/zh/products/deep-linking.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
