故障排除
进行连接、发送交易、签署消息或 RPC 调用时,OneKey 可能返回错误。下表列出错误码及其含义,采用 Ethereum EIP-1474 和 EIP-1193 中的相应错误约定。
| 错误码 | 名称 | 说明 |
|---|---|---|
| 4001 | User Rejected Request | 用户在 OneKey 中拒绝了请求。 |
| 4100 | Unauthorized | 用户未授权所请求的方法或账户。 |
| 4500 | Request Timeout | provider 请求超时。 |
| -32603 | Internal Error | OneKey 内部发生错误。 |
| -32000 | Invalid Input | 参数缺失或无效。 |
| -32601 | Method Not Found | OneKey 无法识别该方法。 |
通常,这些错误很容易解析,并且同时包含错误码和说明。例如:
try {
await provider.requestSignTransactions({ transactions: [transaction] });
} catch (err) {
// {code: 4100, message: 'The requested method and/or account has not been authorized by the user.'}
}
最后更新于