# 波场 Provider API

### 检测和连接TokenPocket Tron Wallet <a href="#detect-and-connect-tokenpocket-tron-wallet" id="detect-and-connect-tokenpocket-tron-wallet"></a>

当你已经安装TokenPocket 插件钱包，你可以获取到 `window.tokenpocket` 对象.

你可以通过  [TIP-1102](https://github.com/tronprotocol/tips/issues/463) 提出的标准请求获取用户的地址

```javascript
await window.tokenpocket.tron.request({method: 'eth_requestAccounts'})
// return ['TMuA6YqfCeX8EhbfYEg5y7S4DqzSJireY9']
```

再获取到地址后你可以使用 `window.tokenpocket.tronWeb` 来进行链上的操作。

比如 SignMessageV2:

`let sig = await tronWeb.trx.signMessageV2('your message')`

更多关于tronWeb的介绍可以参考: <https://github.com/tronprotocol/tronweb/tree/5.x>​

> <br>


---

# 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://help.tokenpocket.pro/developer-cn/extension-wallet/api-reference/tron-provider-api.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.
