TransactionBalancer

Abstracts the wallet operations needed to finalize a proven transaction: adding dust fee inputs (balancing) and submitting to the blockchain.

Two implementations exist:

  • DAppConnectorClient: delegates to an external wallet process via WebSocket JSON-RPC

  • MidnightWallet (in sdk:midnight-sdk): handles everything on-device

MidnightContract.call uses this interface so the contract pipeline is agnostic to whether the wallet is local or remote.

Inheritors

Functions

Link copied to clipboard
open suspend fun balanceAndSubmit(provenTxHex: String, onProgress: suspend (BalanceProgress) -> Unit? = null)

Balance and submit a proven transaction in one operation.

Link copied to clipboard
abstract suspend fun balanceTransaction(provenTxHex: String): String

Balance a proven transaction by adding dust fee inputs.

Link copied to clipboard
abstract suspend fun submitTransaction(balancedTxHex: String)

Submit a balanced transaction to the blockchain.