返回介绍

The signer Module

发布于 2023-06-28 21:14:12 字数 8688 浏览 0 评论 0 收藏 0

JSON-RPC methods

JSON-RPC API Reference

signer_confirmRequest

Confirm a request in the signer queue

Parameters

  1. Quantity - The request id.
  2. Object - Modify the transaction before confirmation.
    • gasPrice: Quantity - (optional) Modify the gas price provided by the sender in Wei.
    • gas: Quantity - (optional) Gas provided by the sender in Wei.
    • condition: Object - (optional) Condition for scheduled transaction. Can be either an integer block number { block: 1 } or UTC timestamp (in seconds) { timestamp: 1491290692 }.
  3. String - The account password
params: [
  "0x1", // 1
  {},
  "hunter2"
]

Returns

  • Object - The status of the confirmation, depending on the request type.

Example

Request

curl --data '{"method":"signer_confirmRequest","params":["0x1",{},"hunter2"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545

Response

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

signer_confirmRequestRaw

Confirm a request in the signer queue providing signed request.

Parameters

  1. Quantity - Integer - The request id
  2. Data - Signed request (RLP encoded transaction)
params: [
  "0x1", // 1
  "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
]

Returns

  • Object - The status of the confirmation, depending on the request type.

Example

Request

curl --data '{"method":"signer_confirmRequestRaw","params":["0x1","0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545

Response

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

signer_confirmRequestWithToken

Confirm specific request with rolling token.

Parameters

  1. Quantity - The request id.
  2. Object - Modify the transaction before confirmation.
    • gasPrice: Quantity - (optional) Modify the gas price provided by the sender in Wei.
    • gas: Quantity - (optional) Gas provided by the sender in Wei.
    • condition: Object - (optional) Conditional submission of the transaction. Can be either an integer block number { block: 1 } or UTC timestamp (in seconds) { time: 1491290692 } or null.
  3. String - Password (initially) or a token returned by the previous call.
params: [
  "0x1", // 1
  {},
  "hunter2"
]

Returns

  • Object - Status.
    • result: Object - The status of the confirmation, depending on the request type.
    • token: String - Token used to authenticate the next request.

Example

Request

curl --data '{"method":"signer_confirmRequestWithToken","params":["0x1",{},"hunter2"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545

Response

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "result": { ... },
    "token": "cAF2w5LE7XUZ3v3N"
  }
}

signer_generateAuthorizationToken

Generates a new authorization token.

Parameters

None

Returns

  • String - The new authorization token.

Example

Request

curl --data '{"method":"signer_generateAuthorizationToken","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545

Response

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "bNGY-iIPB-j7zK-RSYZ"
}

signer_generateWebProxyAccessToken

Generates a new web proxy access token.

Parameters

  1. String - Domain for which the token is valid. Only requests to this domain will be allowed.
params: ["https://parity.io"]

Returns

  • String - The new web proxy access token.

Example

Request

curl --data '{"method":"signer_generateWebProxyAccessToken","params":["https://parity.io"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545

Response

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "MOWm0tEJjwthDiTU"
}

signer_rejectRequest

Rejects a request in the signer queue

Parameters

  1. Quantity - Integer - The request id
params: [
  "0x1" // 1
]

Returns

  • Boolean - The status of the rejection

Example

Request

curl --data '{"method":"signer_rejectRequest","params":["0x1"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545

Response

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": true
}

signer_requestsToConfirm

Returns a list of the transactions awaiting authorization.

Parameters

None

Returns

  • Array - A list of the outstanding transactions.

Example

Request

curl --data '{"method":"signer_requestsToConfirm","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545

Response

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

signer_subscribePending

Starts a subscription for transactions in the confirmation queue.
Each event contains all transactions currently in the queue.

An example notification received by subscribing to this event:
```
{"jsonrpc":"2.0","method":"signer_pending","params":{"subscription":"0x416d77337e24399d","result":[]}}
```

You can unsubscribe using `signer_unsubscribePending` RPC method. Subscriptions are also tied to a transport
connection, disconnecting causes all subscriptions to be canceled.

Parameters

None

Returns

  • String - Assigned subscription ID

Example

Request

wscat -c localhost:8546
>{"method":"signer_subscribePending","params":[],"id":1,"jsonrpc":"2.0"}

Response

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x416d77337e24399d"
}

signer_unsubscribePending

Unsubscribes from pending transactions subscription.

Parameters

  1. String - Subscription ID
params: ["0x416d77337e24399d"]

Returns

  • Boolean - whether the call was successful

Example

Request

wscat -c localhost:8546
>{"method":"signer_unsubscribePending","params":["0x416d77337e24399d"],"id":1,"jsonrpc":"2.0"}

Response

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": true
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文