pub fn init_send_tx(
		&self,
		keychain_mask: Option<&SecretKey>,
		args: InitTxArgs,
		outputs: Option<Vec<&str>>, // outputs to include into the transaction
		routputs: usize,            // Number of resulting outputs. Normally it is 1
	) -> Result<Slate, Error> {
		let address = args.address.clone();

		owner::update_wallet_state(self.wallet_inst.clone(), keychain_mask, &None)?;
		let send_args = args.send_args.clone();
		//minimum_confirmations cannot be zero.
		let minimum_confirmations = args.minimum_confirmations.clone();
		if minimum_confirmations < 1 {
			return Err(ErrorKind::ClientCallback(
				"Minimum_confirmations can not be smaller than 1".to_owned(),
			)
			.into());
		}

		match args.send_args.clone() {
			Some(sa) => {
				if sa.post_tx && !sa.finalize {
					return Err(ErrorKind::ClientCallback(
						"Transcations can not be posted without being finalized!".to_owned(),
					)
					.into());
				}
			}
			None => {}
		}

		let mut slate = {
			let mut w_lock = self.wallet_inst.lock();
			let w = w_lock.lc_provider()?.wallet_inst()?;
			owner::init_send_tx(
				&mut **w,
				keychain_mask,
				args,
				self.doctest_mode,
				outputs,
				routputs,
			)?
		};

		match send_args {
			Some(sa) => {
				let original_slate = slate.clone();

				match sa.method.as_ref() {
					"http" | "keybase" | "mwcmqs" => {
						let tor_config_lock = self.tor_config.lock();
						let comm_adapter = create_sender(
							&sa.method,
							&sa.dest,
							&sa.apisecret,
							tor_config_lock.clone(),
						)
						.map_err(|e| {
							ErrorKind::GenericError(format!("Unable to create a sender, {}", e))
						})?;

						slate = comm_adapter.send_tx(&slate).map_err(|e| {
							ErrorKind::ClientCallback(format!(
								"Unable to send slate {} with {}, {}",
								slate.id, sa.method, e
							))
						})?;
					}
					_ => {
						error!("unsupported payment method: {}", sa.method);
						return Err(ErrorKind::ClientCallback(
							"unsupported payment method".to_owned(),
						)
						.into());
					}
				};

				// Restore back ttl, because it can be gone
				slate.ttl_cutoff_height = original_slate.ttl_cutoff_height.clone();
				// Checking is sender didn't do any harm to slate
				Slate::compare_slates_send(&original_slate, &slate)?;

				self.verify_slate_messages(keychain_mask, &slate)
					.map_err(|e| {
						error!(
							"Unable to validate participant messages at slate {}: {}",
							slate.id, e
						);
						e
					})?;

				self.tx_lock_outputs(keychain_mask, &slate, address, 0)?;
				slate = match sa.finalize {
					true => self.finalize_tx(keychain_mask, &slate)?,
					false => slate,
				};
				println!(
					"slate [{}] finalized successfully in owner_api",
					slate.id.to_string()
				);

				if sa.post_tx {
					self.post_tx(keychain_mask, &slate.tx, sa.fluff)?;
				}
				println!(
					"slate [{}] posted successfully in owner_api",
					slate.id.to_string()
				);
				Ok(slate)
			}
			None => Ok(slate),
		}
	}
/// Initiates a new transaction as the sender, creating a new
/// [`Slate`](../mimble_wallet_libwallet/slate/struct.Slate.html) object containing
/// the sender's inputs, change outputs, and public signature data. This slate can
/// then be sent to the recipient to continue the transaction via the
/// [Foreign API's `receive_tx`](struct.Foreign.html#method.receive_tx) method.
///
/// When a transaction is created, the wallet must also lock inputs (and create unconfirmed
/// outputs) corresponding to the transaction created in the slate, so that the wallet doesn't
/// attempt to re-spend outputs that are already included in a transaction before the transaction
/// is confirmed. This method also returns a function that will perform that locking, and it is
/// up to the caller to decide the best time to call the lock function
/// (via the [`tx_lock_outputs`](struct.Owner.html#method.tx_lock_outputs) method).
/// If the exchange method is intended to be synchronous (such as via a direct http call,)
/// then the lock call can wait until the response is confirmed. If it is asynchronous, (such
/// as via file transfer,) the lock call should happen immediately (before the file is sent
/// to the recipient).
///
/// If the `send_args` [`InitTxSendArgs`](../mimble_wallet_libwallet/types/struct.InitTxSendArgs.html),
/// of the [`args`](../mimble_wallet_libwallet/types/struct.InitTxArgs.html), field is Some, this
/// function will attempt to perform a synchronous send to the recipient specified in the `dest`
/// field according to the `method` field, and will also finalize and post the transaction if
/// the `finalize` field is set.
///
/// # Arguments
/// * `keychain_mask` - Wallet secret mask to XOR against the stored wallet seed before using, if
/// being used.
/// * `args` - [`InitTxArgs`](../mimble_wallet_libwallet/types/struct.InitTxArgs.html),
/// transaction initialization arguments. See struct documentation for further detail.
///
/// # Returns
/// * a result containing:
/// * The transaction [Slate](../mimble_wallet_libwallet/slate/struct.Slate.html),
/// which can be forwarded to the recieving party by any means. Once the caller is relatively
/// certain that the transaction has been sent to the recipient, the associated wallet
/// transaction outputs should be locked via a call to
/// [`tx_lock_outputs`](struct.Owner.html#method.tx_lock_outputs). This must be called before calling
/// [`finalize_tx`](struct.Owner.html#method.finalize_tx).
/// * or [`libwallet::Error`](../mimble_wallet_libwallet/struct.Error.html) if an error is encountered.
///
/// # Remarks
///
/// * This method requires an active connection to a node, and will fail with error if a node
/// cannot be contacted to refresh output statuses.
/// * This method will store a partially completed transaction in the wallet's transaction log,
/// which will be updated on the corresponding call to [`finalize_tx`](struct.Owner.html#method.finalize_tx).
///
/// # Example
/// Set up as in [new](struct.Owner.html#method.new) method above.
/// ```
/// # mimble_wallet_api::doctest_helper_setup_doc_env!(wallet, wallet_config);
///
/// let mut api_owner = Owner::new(wallet.clone(), None, None);
/// // Attempt to create a transaction using the 'default' account
/// let args = InitTxArgs {
///     src_acct_name: None,
///     amount: 2_000_000_000,
///     minimum_confirmations: 2,
///     max_outputs: 500,
///     num_change_outputs: 1,
///     selection_strategy_is_use_all: false,
///     message: Some("Have some Grins. Love, Yeastplume".to_owned()),
///     ..Default::default()
/// };
/// let result = api_owner.init_send_tx(
/// 	None,
/// 	args,
/// 	None,
/// 	1,
/// );
///
/// if let Ok(slate) = result {
/// 	// Send slate somehow
/// 	// ...
/// 	// Lock our outputs if we're happy the slate was (or is being) sent
/// 	api_owner.tx_lock_outputs(None, &slate, None, 0);
/// }
/// ```
Initiates a new transaction as the sender, creating a new
[`Slate`](../mimble_wallet_libwallet/slate/struct.Slate.html) object containing
the sender's inputs, change outputs, and public signature data. This slate can
then be sent to the recipient to continue the transaction via the
[Foreign API's `receive_tx`](struct.Foreign.html#method.receive_tx) method.

When a transaction is created, the wallet must also lock inputs (and create unconfirmed
outputs) corresponding to the transaction created in the slate, so that the wallet doesn't
attempt to re-spend outputs that are already included in a transaction before the transaction
is confirmed. This method also returns a function that will perform that locking, and it is
up to the caller to decide the best time to call the lock function
(via the [`tx_lock_outputs`](struct.Owner.html#method.tx_lock_outputs) method).
If the exchange method is intended to be synchronous (such as via a direct http call,)
then the lock call can wait until the response is confirmed. If it is asynchronous, (such
as via file transfer,) the lock call should happen immediately (before the file is sent
to the recipient).


Initiates a new transaction as the sender creating a new [ ` Slate ` ] ( .. / mimble_wallet_libwallet / slate / struct . Slate . html ) object containing the sender ' s inputs change outputs and public signature data . This slate can then be sent to the recipient to continue the transaction via the [ Foreign API ' s ` receive_tx ` ] ( struct . Foreign . html#method . receive_tx ) method . When a transaction is created the wallet must also lock inputs ( and create unconfirmed outputs ) corresponding to the transaction created in the slate so that the wallet doesn ' t attempt to re - spend outputs that are already included in a transaction before the transaction is confirmed . This method also returns a function that will perform that locking and it is up to the caller to decide the best time to call the lock function ( via the [ ` tx_lock_outputs ` ] ( struct . Owner . html#method . tx_lock_outputs ) method ) . If the exchange method is intended to be synchronous ( such as via a direct http call ) then the lock call can wait until the response is confirmed . If it is asynchronous ( such as via file transfer ) the lock call should happen immediately ( before the file is sent to the recipient ) .
pub fn init_send_tx(
		&self,
		keychain_mask: Option<&SecretKey>,
		args: InitTxArgs,
		outputs: Option<Vec<&str>>, // outputs to include into the transaction
		routputs: usize,            // Number of resulting outputs. Normally it is 1
	) -> Result<Slate, Error> {
		let address = args.address.clone();
		owner::update_wallet_state(self.wallet_inst.clone(), keychain_mask, &None)?;
		let send_args = args.send_args.clone();
		//minimum_confirmations cannot be zero.
		let minimum_confirmations = args.minimum_confirmations.clone();
		if minimum_confirmations < 1 {
			return Err(ErrorKind::ClientCallback(
				"Minimum_confirmations can not be smaller than 1".to_owned(),
			)
			.into());
		}
		match args.send_args.clone() {
			Some(sa) => {
				if sa.post_tx && !sa.finalize {
					return Err(ErrorKind::ClientCallback(
						"Transcations can not be posted without being finalized!".to_owned(),
					)
					.into());
				}
			}
			None => {}
		}
		let mut slate = {
			let mut w_lock = self.wallet_inst.lock();
			let w = w_lock.lc_provider()?.wallet_inst()?;
			owner::init_send_tx(
				&mut **w,
				keychain_mask,
				args,
				self.doctest_mode,
				outputs,
				routputs,
			)?
		};
		match send_args {
			Some(sa) => {
				let original_slate = slate.clone();
				match sa.method.as_ref() {
					"http" | "keybase" | "mwcmqs" => {
						let tor_config_lock = self.tor_config.lock();
						let comm_adapter = create_sender(
							&sa.method,
							&sa.dest,
							&sa.apisecret,
							tor_config_lock.clone(),
						)
						.map_err(|e| {
							ErrorKind::GenericError(format!("Unable to create a sender, {}", e))
						})?;
						slate = comm_adapter.send_tx(&slate).map_err(|e| {
							ErrorKind::ClientCallback(format!(
								"Unable to send slate {} with {}, {}",
								slate.id, sa.method, e
							))
						})?;
					}
					_ => {
						error!("unsupported payment method: {}", sa.method);
						return Err(ErrorKind::ClientCallback(
							"unsupported payment method".to_owned(),
						)
						.into());
					}
				};
				// Restore back ttl, because it can be gone
				slate.ttl_cutoff_height = original_slate.ttl_cutoff_height.clone();
				// Checking is sender didn't do any harm to slate
				Slate::compare_slates_send(&original_slate, &slate)?;
				self.verify_slate_messages(keychain_mask, &slate)
					.map_err(|e| {
						error!(
							"Unable to validate participant messages at slate {}: {}",
							slate.id, e
						);
						e
					})?;
				self.tx_lock_outputs(keychain_mask, &slate, address, 0)?;
				slate = match sa.finalize {
					true => self.finalize_tx(keychain_mask, &slate)?,
					false => slate,
				};
				println!(
					"slate [{}] finalized successfully in owner_api",
					slate.id.to_string()
				);
				if sa.post_tx {
					self.post_tx(keychain_mask, &slate.tx, sa.fluff)?;
				}
				println!(
					"slate [{}] posted successfully in owner_api",
					slate.id.to_string()
				);
				Ok(slate)
			}
			None => Ok(slate),
		}
	}
pub fn init_send_tx ( & self , keychain_mask : Option < & SecretKey > , args : InitTxArgs , outputs : Option < Vec < & str > > , // outputs to include into the transaction routputs : usize , // Number of resulting outputs. Normally it is 1 ) -> Result < Slate , Error > { let address = args . address . clone ( ) ; owner :: update_wallet_state ( self . wallet_inst . clone ( ) , keychain_mask , & None ) ? ; let send_args = args . send_args . clone ( ) ; //minimum_confirmations cannot be zero. let minimum_confirmations = args . minimum_confirmations . clone ( ) ; if minimum_confirmations < 1 { return Err ( ErrorKind :: ClientCallback ( " " . to_owned ( ) , ) . into ( ) ) ; } match args . send_args . clone ( ) { Some ( sa ) => { if sa . post_tx && ! sa . finalize { return Err ( ErrorKind :: ClientCallback ( " " . to_owned ( ) , ) . into ( ) ) ; } } None => { } } let mut slate = { let mut w_lock = self . wallet_inst . lock ( ) ; let w = w_lock . lc_provider ( ) ? . wallet_inst ( ) ? ; owner :: init_send_tx ( & mut * * w , keychain_mask , args , self . doctest_mode , outputs , routputs , ) ? } ; match send_args { Some ( sa ) => { let original_slate = slate . clone ( ) ; match sa . method . as_ref ( ) { " " | " " | " " => { let tor_config_lock = self . tor_config . lock ( ) ; let comm_adapter = create_sender ( & sa . method , & sa . dest , & sa . apisecret , tor_config_lock . clone ( ) , ) . map_err ( | e | { ErrorKind :: GenericError ( format ! ( " " e ) ) } ) ? ; slate = comm_adapter . send_tx ( & slate ) . map_err ( | e | { ErrorKind :: ClientCallback ( format ! ( " " slate id sa method e ) ) } ) ? ; } _ => { error ! ( " " sa method ) ; return Err ( ErrorKind :: ClientCallback ( " " . to_owned ( ) , ) . into ( ) ) ; } } ; // Restore back ttl, because it can be gone slate . ttl_cutoff_height = original_slate . ttl_cutoff_height . clone ( ) ; // Checking is sender didn't do any harm to slate Slate :: compare_slates_send ( & original_slate , & slate ) ? ; self . verify_slate_messages ( keychain_mask , & slate ) . map_err ( | e | { error ! ( " " slate id e ) ; e } ) ? ; self . tx_lock_outputs ( keychain_mask , & slate , address , 0 ) ? ; slate = match sa . finalize { true => self . finalize_tx ( keychain_mask , & slate ) ? , false => slate , } ; println ! ( " " slate id to_string ( ) ) ; if sa . post_tx { self . post_tx ( keychain_mask , & slate . tx , sa . fluff ) ? ; } println ! ( " " slate id to_string ( ) ) ; Ok ( slate ) } None => Ok ( slate ) , } }
Initiates a new transaction as the sender, creating a new
[`Slate`](../mimble_wallet_libwallet/slate/struct.Slate.html) object containing
the sender's inputs, change outputs, and public signature data.
Initiates a new transaction as the sender creating a new [ ` Slate ` ] ( .. / mimble_wallet_libwallet / slate / struct . Slate . html ) object containing the sender ' s inputs change outputs and public signature data .
&self
keychain_mask
Option<&SecretKey>
args
InitTxArgs
outputs
Option<Vec<&str>>
routputs
usize
a result containing:
The transaction [Slate](../mimble_wallet_libwallet/slate/struct.Slate.html),
which can be forwarded to the recieving party by any means. Once the caller is relatively
certain that the transaction has been sent to the recipient, the associated wallet
transaction outputs should be locked via a call to
[`tx_lock_outputs`](struct.Owner.html#method.tx_lock_outputs). This must be called before calling
[`finalize_tx`](struct.Owner.html#method.finalize_tx).
or [`libwallet::Error`](../mimble_wallet_libwallet/struct.Error.html) if an error is encountered.
a result containing : The transaction [ Slate ] ( .. / mimble_wallet_libwallet / slate / struct . Slate . html ) which can be forwarded to the recieving party by any means . Once the caller is relatively certain that the transaction has been sent to the recipient the associated wallet transaction outputs should be locked via a call to [ ` tx_lock_outputs ` ] ( struct . Owner . html#method . tx_lock_outputs ) . This must be called before calling [ ` finalize_tx ` ] ( struct . Owner . html#method . finalize_tx ) . or [ ` libwallet :: Error ` ] ( .. / mimble_wallet_libwallet / struct . Error . html ) if an error is encountered .
&self
keychain_mask
Option<&SecretKey>
args
InitTxArgs
outputs
Option<Vec<&str>>
routputs
usize
remarks
This method requires an active connection to a node, and will fail with error if a node
cannot be contacted to refresh output statuses.
This method will store a partially completed transaction in the wallet's transaction log,
which will be updated on the corresponding call to [`finalize_tx`](struct.Owner.html#method.finalize_tx).
This method requires an active connection to a node and will fail with error if a node cannot be contacted to refresh output statuses . This method will store a partially completed transaction in the wallet ' s transaction log which will be updated on the corresponding call to [ ` finalize_tx ` ] ( struct . Owner . html#method . finalize_tx ) .
example
Set up as in [new](struct.Owner.html#method.new) method above.
Set up as in [ new ] ( struct . Owner . html#method . new ) method above .
mimble_wallet_api::doctest_helper_setup_doc_env!(wallet, wallet_config);
let mut api_owner = Owner::new(wallet.clone(), None, None);
Attempt to create a transaction using the 'default' account
let args = InitTxArgs {
src_acct_name: None,
amount: 2_000_000_000,
minimum_confirmations: 2,
max_outputs: 500,
num_change_outputs: 1,
selection_strategy_is_use_all: false,
message: Some("Have some Grins. Love, Yeastplume".to_owned()),
Default::default()
};
let result = api_owner.init_send_tx(
None,
args,
None,
1,
).

if let Ok(slate) = result {
Send slate somehow

Lock our outputs if we're happy the slate was (or is being) sent
api_owner.tx_lock_outputs(None, &slate, None, 0);
}
```
let mut api_owner = Owner :: new ( wallet . clone () None None ) ; Attempt to create a transaction using the ' default ' account let args = InitTxArgs { src_acct_name : None amount : 2_000_000_000 minimum_confirmations : 2 max_outputs : 500 num_change_outputs : 1 selection_strategy_is_use_all : false message : Some ( " Have some Grins . Love Yeastplume " . to_owned () ) Default :: default () } ; let result = api_owner . init_send_tx ( None args None 1 ) . if let Ok ( slate ) = result { Send slate somehow Lock our outputs if we ' re happy the slate was ( or is being ) sent api_owner . tx_lock_outputs ( None &slate None 0 ) ; } ` ` `