CubWallet Docs
中文

Operation types

bts_signTransaction and bts_signAndBroadcast accept only params.operations. The wallet serializes the operations, asks the node for fees and a reference block, then opens the approval window.

Format and limits

Each operation is a pair: [type, data].

Fees: you may omit fee, or set fee.amount to "0". The wallet then queries the required fee and fills it in. If you set a non-zero fee, the wallet keeps that value (it must still pass serialization and later chain checks).

The wallet fills in the transaction envelope; do not send:

Before signing, the wallet also checks that the node's chain_id equals the selected network, and that the transaction expiration is after the head block and no more than 1 hour ahead (stricter than the usual 1-day chain limit). The user can confirm only after these checks pass.

Plaintext memos

For the operations below you may set memo (extensions.memo on htlc_create) to a plain string, or to { "plaintext": "…" }. The wallet encrypts it in the service worker with the private key that matches the sender's current on-chain memo public key. The approval window shows the decrypted text:

A plaintext memo on any other operation fails with <operation> 不支持明文备注. The memo may be at most 2048 bytes. If the wallet does not hold the current memo key for that account, the request is rejected with an explanatory message. A memo that is already { from, to, nonce, message } is left as-is.

A public node that a page uses to resolve names and symbols is only a convenience for filling forms. The approval window, decoded from the transaction bytes, is authoritative.

Examples

The following examples can be passed to bts_signTransaction as-is. Replace 1.2.x with an authorized account, and replace sample object ids with objects that exist on the current chain. Amounts are integers in the smallest unit.

Transfer transfer

json
[["transfer", {
  "from": "1.2.100",
  "to": "1.2.17",
  "amount": { "amount": "100000", "asset_id": "1.3.0" },
  "memo": "order #123",
  "extensions": []
}]]

Mainnet BTS (1.3.0) has precision 5, so 100000 means 1.00000 BTS.

Limit order limit_order_create

json
[["limit_order_create", {
  "seller": "1.2.100",
  "amount_to_sell": { "amount": "100000", "asset_id": "1.3.0" },
  "min_to_receive": { "amount": "5", "asset_id": "1.3.113" },
  "expiration": "2030-01-01T00:00:00",
  "fill_or_kill": false,
  "extensions": []
}]]

This expiration is the order's lifetime, not the transaction expiration. An optional extensions.on_fill can place a take-profit order after a fill; add it only when you need it.

Cancel order limit_order_cancel

json
[["limit_order_cancel", {
  "fee_paying_account": "1.2.100",
  "order": "1.7.123456",
  "extensions": []
}]]

Pool swap liquidity_pool_exchange

json
[["liquidity_pool_exchange", {
  "account": "1.2.100",
  "pool": "1.19.2",
  "amount_to_sell": { "amount": "100000", "asset_id": "1.3.0" },
  "min_to_receive": { "amount": "1", "asset_id": "1.3.113" },
  "extensions": []
}]]

The approval window re-quotes against the current on-chain pool and compares the result with min_to_receive.

Pool deposit / withdraw

json
[["liquidity_pool_deposit", {
  "account": "1.2.100",
  "pool": "1.19.3",
  "amount_a": { "amount": "100000", "asset_id": "1.3.0" },
  "amount_b": { "amount": "10", "asset_id": "1.3.113" },
  "extensions": []
}]]
json
[["liquidity_pool_withdraw", {
  "account": "1.2.100",
  "pool": "1.19.3",
  "share_amount": { "amount": "100", "asset_id": "1.3.1000" },
  "extensions": []
}]]

Create a proposal proposal_create

json
[["proposal_create", {
  "fee_paying_account": "1.2.100",
  "expiration_time": "2030-01-01T00:00:00",
  "proposed_ops": [
    ["transfer", {
      "from": "1.2.100",
      "to": "1.2.17",
      "amount": { "amount": "12345", "asset_id": "1.3.0" },
      "extensions": []
    }]
  ],
  "extensions": []
}]]

proposed_ops may also be written as [{ "op": ["transfer", { … }] }]. The wallet normalizes to that wrapped form. Creating a proposal usually needs only the proposer's active authority; accounts affected by the inner operations approve later with proposal_update. If a nested operation would change owner authority, the approval window uses the highest risk level and asks for extra confirmation.

Approve or delete a proposal

json
[["proposal_update", {
  "fee_paying_account": "1.2.100",
  "proposal": "1.10.100",
  "active_approvals_to_add": ["1.2.100"],
  "active_approvals_to_remove": [],
  "owner_approvals_to_add": [],
  "owner_approvals_to_remove": [],
  "key_approvals_to_add": [],
  "key_approvals_to_remove": [],
  "extensions": []
}]]
json
[["proposal_delete", {
  "fee_paying_account": "1.2.100",
  "using_owner_authority": false,
  "proposal": "1.10.100",
  "extensions": []
}]]

The wallet loads the proposal from the chain and shows the inner operations in the approval window. If owner authority is required, the user must type the account name and re-enter the wallet password.

Lifetime-member upgrade account_upgrade

json
[["account_upgrade", {
  "account_to_upgrade": "1.2.100",
  "upgrade_to_lifetime_member": true,
  "extensions": []
}]]

All operations

The wallet implements operations 0–77 of the current BitShares-Core protocol, including serialization. The table below is generated from the source. The 7 virtual operations cannot be submitted.

IdNameDescriptionSignable
0transfer转账Yes
1limit_order_create挂单(限价单)Yes
2limit_order_cancel撤单Yes
3call_order_update调整抵押债仓Yes
4fill_order订单成交(虚拟操作)Virtual, not signable
5account_create注册账户Yes
6account_update修改账户(权限/投票/备注密钥)Yes
7account_whitelist账户白/黑名单Yes
8account_upgrade升级为终身会员Yes
9account_transfer转让账户(已停用)Yes
10asset_create创建资产Yes
11asset_update修改资产参数Yes
12asset_update_bitasset修改智能资产参数Yes
13asset_update_feed_producers修改喂价人Yes
14asset_issue发行资产Yes
15asset_reserve销毁资产(不可逆)Yes
16asset_fund_fee_pool注资手续费池Yes
17asset_settle强制清算(按喂价结算)Yes
18asset_global_settle全局清算(黑天鹅)Yes
19asset_publish_feed发布喂价Yes
20witness_create创建见证人Yes
21witness_update修改见证人Yes
22proposal_create创建提案Yes
23proposal_update批准/撤销批准提案Yes
24proposal_delete否决/删除提案Yes
25withdraw_permission_create授权他人定期提款Yes
26withdraw_permission_update修改提款授权Yes
27withdraw_permission_claim按授权提款Yes
28withdraw_permission_delete撤销提款授权Yes
29committee_member_create创建理事会成员Yes
30committee_member_update修改理事会成员Yes
31committee_member_update_global_parameters修改全局链参数(理事会)Yes
32vesting_balance_create创建锁仓余额Yes
33vesting_balance_withdraw提取锁仓余额Yes
34worker_create创建预算项目(worker)Yes
35custom自定义数据Yes
36assert链上断言Yes
37balance_claim领取创世/锁定余额Yes
38override_transfer发行人强制转移Yes
39transfer_to_blind转入隐私(盲)余额Yes
40blind_transfer隐私(盲)转账Yes
41transfer_from_blind从隐私(盲)余额转出Yes
42asset_settle_cancel取消清算(虚拟操作)Virtual, not signable
43asset_claim_fees提取资产市场手续费Yes
44fba_distributeFBA 分配(虚拟操作)Virtual, not signable
45bid_collateral黑天鹅后竞价抵押Yes
46execute_bid竞价成交(虚拟操作)Virtual, not signable
47asset_claim_pool提取手续费池Yes
48asset_update_issuer转让资产发行人Yes
49htlc_create创建哈希时间锁(HTLC)Yes
50htlc_redeem兑付 HTLCYes
51htlc_redeemedHTLC 已兑付(虚拟操作)Virtual, not signable
52htlc_extend延长 HTLCYes
53htlc_refundHTLC 退款(虚拟操作)Virtual, not signable
54custom_authority_create创建自定义权限Yes
55custom_authority_update修改自定义权限Yes
56custom_authority_delete删除自定义权限Yes
57ticket_create创建投票锁仓票Yes
58ticket_update修改投票锁仓票Yes
59liquidity_pool_create创建流动池Yes
60liquidity_pool_delete删除流动池Yes
61liquidity_pool_deposit流动池注资Yes
62liquidity_pool_withdraw流动池撤资Yes
63liquidity_pool_exchange流动池兑换Yes
64samet_fund_create创建闪电贷资金池Yes
65samet_fund_delete删除闪电贷资金池Yes
66samet_fund_update修改闪电贷资金池Yes
67samet_fund_borrow闪电贷借款Yes
68samet_fund_repay闪电贷还款Yes
69credit_offer_create创建借贷报价Yes
70credit_offer_delete删除借贷报价Yes
71credit_offer_update修改借贷报价Yes
72credit_offer_accept接受借贷报价(借款)Yes
73credit_deal_repay偿还借贷Yes
74credit_deal_expired借贷到期(虚拟操作)Virtual, not signable
75liquidity_pool_update修改流动池费率Yes
76credit_deal_update修改借贷自动还款Yes
77limit_order_update修改限价单Yes

Unknown types are always rejected: 不支持的操作类型: <type>(未知操作一律拒绝).