Skip to contents

Locks one or more unspent outputs (assets or native currency) to be used as part of an atomic exchange. The locked output is prepared in a way that it can only be spent as part of an atomic exchange transaction.

Usage

mc_prepare_lock_unspent(conn, amounts, lock = TRUE)

Arguments

conn

A connection object created by mc_connect.

amounts

A list specifying the assets or native currency to lock. Format: list(asset_name = quantity, ...) or a numeric value for native currency.

lock

Logical. If TRUE (default), the output is locked for automatic spending (i.e., it will be used only in the exchange). If FALSE, the output is simply prepared but not locked.

Value

A list with two elements:

txid

Transaction ID of the prepared/locked output.

vout

Output index.

Examples

if (FALSE) { # \dontrun{
# Lock 10 units of 'myasset' and 0.5 native currency
locked <- mc_prepare_lock_unspent(conn, amounts = list(myasset = 10, 0.5))
# Now use locked$txid and locked$vout in an exchange
} # }