selectAndLockUtxosMultiToken
suspend fun selectAndLockUtxosMultiToken(address: String, requiredAmounts: Map<String, BigInteger>): UtxoSelector.MultiTokenResult
Select and lock UTXOs for multiple token types (atomic operation).
Performs coin selection for multiple tokens in a single transaction. If ANY token has insufficient funds, NO UTXOs are locked (all-or-nothing).
Atomicity: Room's @Transaction ensures all-or-nothing behavior:
If all tokens succeed → Lock ALL selected UTXOs
If any token fails → Lock NONE (rollback)
Usage:
val requirements = mapOf(
"NIGHT" to BigInteger("100000000"),
"DUST" to BigInteger("50000000")
)
val result = utxoManager.selectAndLockUtxosMultiToken(address, requirements)Content copied to clipboard
Return
MultiTokenResult (Success with all selections, or PartialFailure)
Parameters
address
Owner address
requiredAmounts
Map of tokenType → required amount