Errors
When window.bitshares.request fails, it rejects a standard Error. The only value the page receives is error.message (a string). There is no EIP-1193-style numeric code and no data field.
Only that string is copied across the content-script boundary, so match on the full message (some messages interpolate an account id, a public key or a method name). The tables below list the messages the current source can return to a dApp.
Entry point
| Message | When |
|---|---|
method required | request was called without a string method |
扩展连接失败 | The content script could not reach the extension background (disabled or reloading) |
不支持的方法: <method> | The method name is not one of the four implemented methods |
Approval window
| Message | When |
|---|---|
该站点已有待处理的请求 | This origin already has a connect or sign request in flight |
待处理请求过多 | The wallet already has 5 pending approvals |
请求超时 | The approval window had no result after 5 minutes |
用户拒绝了请求 | The user clicked reject |
用户关闭了确认窗口 | The user closed the approval window |
请求不存在或已过期。若钱包刚锁定或后台被回收,请在 dApp 中重新发起请求。 | The pending record is gone (for example the service worker was discarded) |
Authorization and accounts
| Message | When |
|---|---|
未授权:请先调用 bts_requestAccounts | A signing method was called before this origin was authorized |
账户 <id> 未授权给此站点 | An account that must sign or encrypt a memo is not authorized for this origin |
账户 <id> 在钱包中没有私钥 | The account is watch-only, or the wallet has no private key for it |
公钥 <pub> 不属于已授权给此站点的账户 | The operation names a public key that does not belong to an authorized account |
盲输入所需的密钥不属于已授权给此站点的账户(钱包不支持盲转账一次性密钥) | A blinded input key does not belong to an authorized account |
Operation format
| Message | When |
|---|---|
operations 不能为空 | operations is missing or is not a non-empty array |
单笔交易/提案最多 10 个操作 | A level contains more than 10 operations |
提案嵌套过深 | proposal_create is nested more than 3 levels deep |
operation must be [type, data] | An item is not a 2-element array, or the second element is not an object |
不支持的操作类型: <type>(未知操作一律拒绝) | Unknown operation name or id |
<name> 是链上自动生成的虚拟操作,不能签名提交 | A virtual operation was submitted |
proposal_create.proposed_ops 不能为空 | A proposal was created with no inner operations |
Illegal field types, missing required fields, or values the serializer cannot encode also fail while the transaction is built. The message then comes from the serializer or from a node query. Use correct account / asset ids, integer amounts and timestamp strings.
Memos
| Message | When |
|---|---|
<name> 不支持明文备注 | A plaintext memo was set on an operation that does not support it |
备注过长(最多 2048 字节) | The plaintext memo is longer than 2048 bytes |
备注的发送方或接收方账户不存在 | The chain has no account for the memo sender or recipient |
本钱包没有账户 <name> 当前的备注(memo)私钥,无法加密备注 | The wallet does not hold the private key for the account's current memo public key |
Pre-sign checks (chain id and expiration)
These run when the approval window is opened. If they fail, the window shows the error and the user cannot approve; if approval is still attempted, the same message is returned to the dApp.
| Message | When |
|---|---|
chain_id 不匹配:当前网络 <first 8 of expected>…, 节点/交易 <first 8 of actual>… | The node's chain id does not match the wallet's current network |
交易已过期,已拒绝签名 | The transaction expiration is not after the head-block time or local now |
交易过期时间超过 BitShares 上限(1 天),已拒绝签名 | Expiration is more than 86400 seconds after the head block |
交易过期时间过长(超过 1 小时),已拒绝签名 | Expiration is more than 3600 seconds after the head block (stricter than the chain) |
Normally the wallet sets expiration to 10 minutes after the head block, so the last three should not appear. A node with the wrong chain id, or a very wrong local clock, can still trigger them.
After the user approves (keys)
These appear when the user has already confirmed but the wallet cannot finish signing.
| Message | When |
|---|---|
此交易需要 owner 私钥。请在确认窗口重新输入钱包密码并明确同意。 | The owner key is required but the password was not re-entered |
请输入账户名以确认使用 owner 私钥 | The account name was not typed as required |
请输入钱包密码以使用 owner 私钥 | The wallet password was not entered |
请先解锁 | The wallet was locked at confirm time |
钱包中没有单独保护的 owner 私钥 | There is no owner-key vault |
本钱包没有账户 <id> 的 OWNER 私钥 | The owner private key for that account is missing |
本钱包没有账户 <id> 的 active 私钥 | The active private key for that account is missing |
本钱包没有公钥 <pub> 对应的私钥 | The named public key is not in the wallet |
dApp 不能在未明确同意的情况下使用 owner 私钥 | An owner key was required for a named key without the extra consent step |
本钱包没有满足盲输入所需权限的密钥 | No key satisfies the blinded input authority |
没有可用于签名的密钥 | No signing key could be selected |
请选择至少一个账户 | No account was checked in the connect window |
Show error.message to the user. Do not assume a particular error “cannot happen”. Rejection, closing the window and timeout are normal outcomes, not application faults that should immediately re-open a popup.
CubWallet