build_tx

Function build_tx 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn build_tx( descriptor: *const c_char, node_address: *const c_char, tx_outputs: *const c_char, fee_absolute: *const c_char, sweep: *const c_char, ) -> *mut c_char
Expand description

Builds a transaction for a given descriptor wallet. Supports sending to multiple outputs. TxOutputs have to be provided as a stringified JSON array.

TxOutput{
 address: String,
 amount: u64,
}
 
TxOutputs = Vec<TxOutput>

If sweep is set to true, amount value is ignored and will default to None. Set amount to 0 for sweep.

  • OUTPUT
 WalletPSBT {
   pub psbt: String,
   pub is_finalized: bool,
 }

ยงSafety

  • This function is unsafe because it dereferences and a returns raw pointer.
  • ENSURE that result is passed into cstring_free(ptr: *mut c_char) after use.