flow

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package flow 交易构建与广播流程;签名由外部 MPC 提供,本包负责构建待签交易单与提交广播。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSummaryTransaction

func BuildSummaryTransaction(d decoder.TransactionDecoder, wrapper wallet.WalletDAI, sumRawTx *types.SummaryRawTransaction) ([]*types.PendingSignTx, error)

BuildSummaryTransaction 构建汇总交易单列表(每笔可能带 Error): 由 decoder 返回 RawTransactionWithError 列表,然后逐笔补齐 nonce/time/type -> wrapper 签名 -> 生成 PendingSignTx。

func BuildTransaction

func BuildTransaction(d decoder.TransactionDecoder, wrapper wallet.WalletDAI, rawTx *types.RawTransaction) (*types.PendingSignTx, error)

BuildTransaction 构建普通交易单: 1) decoder 负责构建 rawTx(rawHex/fees/sigParts 等) 2) flow 负责补充 createTime/createNonce/txType 并序列化为 JSON 3) wrapper.SignPendingTxData 对 rawTx JSON 做业务侧签名,返回 PendingSignTx(含 dataSign/tradeSign) 重要:PendingSignTx.Data 必须使用 originalTxJSON 副本,避免 wrapper 内部修改 txJSON 影响最终提交数据

func GetRandomSecure

func GetRandomSecure(l int) ([]byte, error)

GetRandomSecure 使用加密安全的随机数生成器生成指定字节数组(推荐)

func SendTransaction

func SendTransaction(d decoder.TransactionDecoder, wrapper wallet.WalletDAI, pendingTx *types.PendingSignTx) (*types.Transaction, error)

SendTransaction 广播交易单: 1) 校验 dataSign/tradeSign 与 Data 一致,防止 Data 被篡改 2) Data 反序列化 rawTx,合并 SignerList -> rawTx.Signatures 3) VerifyRawTransaction 校验签名 4) SubmitRawTransaction 广播

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL