Infura开发手册

eth_accounts

返回客户端持有的地址清单。

API请求

POST https://<network>.infura.io/v3/YOUR-PROJECT-ID

请求头:

Content-Type: application/json

请求示例:

JSON-RPC over HTTPS POST:

curl https://mainnet.infura.io/v3/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":1}'

JSON-RPC over websockets:

wscat -c wss://mainnet.infura.io/ws
>{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":1}

API响应

响应结果对象结构如下:

  • ADDRESSES:地址数组

注意,虽然Infura支持这个JSON-RPC方法,但是它不会返回任何账户。Infura 不支持解锁账户,因此用户应当使用eth_sendRawTransaction发送已经签名的裸交易。

响应结果示例:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": []
}