Appearance
@keymaster/connect / FeepoolPrepareResult
Interface: FeepoolPrepareResult
feepool.prepare 成功结果。
设计缘由(V4 收口):feepool 真实模型是"两笔 tx + 持续协商的 B-Tx 草稿"。
baseTxHex:建池那笔 A-Tx(client P2PKH → 2-of-2 multisig), 仅 client 签(funding 来自 client 自己的 UTXO),不需要 server sig。draftSpendTxHex/draftClientSignBytes:当前 B-Tx 草稿(multisig output → server + client change)。三种 action 都有。不是真广播的 tx, 是 site / server 持续协商的草稿。
三种 action 返回的字段:
create:baseTxHex + baseTxOutputIndex + draftSpendTxHex + draftClientSignBytes (建池 + 初始 B-Tx 草稿;草稿 serverAmount = amountSatoshis)。spend:draftSpendTxHex + draftClientSignBytes(更新后的 B-Tx 草稿; 在旧草稿上累计 serverAmount 并 client 重签,不再单独发一笔 draftTx,不走 dust close 路径,不广播)。close_and_recreate:closeDraftTxHex + closeClientSignBytes(close 草稿: 旧草稿切到FINAL_LOCKTIME最终版本) + baseTxHex + baseTxOutputIndex (新池 A-Tx) + draftSpendTxHex + draftClientSignBytes(新池初始 B-Tx 草稿)。
字段命名说明:draftSpendTxHex / closeDraftTxHex 中的 draft 强调 "是当前草稿、不是真广播的 tx";closeDraftTxHex 同理(是 close 版本的 草稿)。operationId 同步在 prepare 阶段产出,commit 阶段回带。
Properties overview
| Property | Type | Required | Description |
|---|---|---|---|
operationId | string | Yes | operationId 仅在当前 popup 会话内有效;popup 关闭后失效。 |
action | ProtocolFeePoolAction | Yes | — |
counterpartyPublicKeyHex | string | Yes | — |
amountSatoshis | number | Yes | 本次 transfer 的 delta(site 请求的 amountSatoshis)。 |
baseTxHex? | string | No | 建池 A-Tx(action === "create" 或 "close_and_recreate")。 |
baseTxOutputIndex? | number | No | multisig output 在 base tx 里的 vout index。 |
draftSpendTxHex | string | Yes | 主 B-Tx 草稿(三种 action 都有)。 |
draftClientSignBytes | BinaryField | Yes | 当前 draftSpendTxHex 上的 client 部分签名。 |
closeDraftTxHex? | string | No | close_and_recreate 的 close 版本 B-Tx 草稿(仅 close_and_recreate)。 |
closeClientSignBytes? | BinaryField | No | closeDraftTxHex 上的 client 部分签名。 |
priorPoolRecord? | { baseTxid: string; totalAmount: number; serverAmount: number; draftSpendTxHex?: string; } | null | No | 决策时参考的旧池快照。 |
Properties
operationId
operationId:
string
operationId 仅在当前 popup 会话内有效;popup 关闭后失效。
action
action:
ProtocolFeePoolAction
counterpartyPublicKeyHex
counterpartyPublicKeyHex:
string
amountSatoshis
amountSatoshis:
number
本次 transfer 的 delta(site 请求的 amountSatoshis)。
baseTxHex?
optionalbaseTxHex?:string
建池 A-Tx(action === "create" 或 "close_and_recreate")。 create:唯一的一笔;close_and_recreate:新建池那笔。 仅 client 签;不需要 server sig。
baseTxOutputIndex?
optionalbaseTxOutputIndex?:number
multisig output 在 base tx 里的 vout index。
draftSpendTxHex
draftSpendTxHex:
string
主 B-Tx 草稿(三种 action 都有)。 create / close_and_recreate 的新池分支:这是初始 B-Tx 草稿。 spend / close_and_recreate 的 close 之前的 spend 分支:这是更新后的草稿。
当前草稿,不是真广播的 tx;是 site 与 server 持续协商的对象。
draftClientSignBytes
draftClientSignBytes:
BinaryField
当前 draftSpendTxHex 上的 client 部分签名。
closeDraftTxHex?
optionalcloseDraftTxHex?:string
close_and_recreate 的 close 版本 B-Tx 草稿(仅 close_and_recreate)。 由 SDK loadTx 把旧 draft 切到 FINAL_LOCKTIME 最终版本得到; commit 落地后这个 close 草稿会被双方广播(V1 简化:暂时不广播)。
closeClientSignBytes?
optionalcloseClientSignBytes?:BinaryField
closeDraftTxHex 上的 client 部分签名。
priorPoolRecord?
optionalpriorPoolRecord?: {baseTxid:string;totalAmount:number;serverAmount:number;draftSpendTxHex?:string; } |null
决策时参考的旧池快照。