Function tari_wallet_ffi::wallet_create [−][src]
#[no_mangle]pub unsafe extern "C" fn wallet_create(
config: *mut TariCommsConfig,
log_path: *const c_char,
num_rolling_log_files: c_uint,
size_per_log_file_bytes: c_uint,
passphrase: *const c_char,
callback_received_transaction: unsafe extern "C" fn(_: *mut TariPendingInboundTransaction),
callback_received_transaction_reply: unsafe extern "C" fn(_: *mut TariCompletedTransaction),
callback_received_finalized_transaction: unsafe extern "C" fn(_: *mut TariCompletedTransaction),
callback_transaction_broadcast: unsafe extern "C" fn(_: *mut TariCompletedTransaction),
callback_transaction_mined: unsafe extern "C" fn(_: *mut TariCompletedTransaction),
callback_direct_send_result: unsafe extern "C" fn(_: c_ulonglong, _: bool),
callback_store_and_forward_send_result: unsafe extern "C" fn(_: c_ulonglong, _: bool),
callback_transaction_cancellation: unsafe extern "C" fn(_: *mut TariCompletedTransaction),
callback_base_node_sync_complete: unsafe extern "C" fn(_: u64, _: bool),
callback_saf_messages_received: unsafe extern "C" fn(),
error_out: *mut c_int
) -> *mut TariWallet
---------------------------------------------------------------------------------------------- /// ------------------------------------- Wallet -------------------------------------------------/// Creates a TariWallet
Arguments
config
- The TariCommsConfig pointer
log_path
- An optional file path to the file where the logs will be written. If no log is required pass null
pointer.
num_rolling_log_files
- Specifies how many rolling log files to produce, if no rolling files are wanted then set
this to 0
size_per_log_file_bytes
- Specifies the size, in bytes, at which the logs files will roll over, if no
rolling files are wanted then set this to 0
passphrase
- An optional string that represents the passphrase used to
encrypt/decrypt the databases for this wallet. If it is left Null no encryption is used. If the databases have been
encrypted then the correct passphrase is required or this function will fail.
callback_received_transaction
- The callback function pointer matching the
function signature. This will be called when an inbound transaction is received.
callback_received_transaction_reply
- The callback function pointer matching the function signature. This will be
called when a reply is received for a pending outbound transaction
callback_received_finalized_transaction
- The callback function pointer matching the function signature. This will
be called when a Finalized version on an Inbound transaction is received
callback_transaction_broadcast
- The callback function pointer matching the function signature. This will be
called when a Finalized transaction is detected a Broadcast to a base node mempool.
callback_transaction_mined
- The callback function pointer matching the function signature. This will be called
when a Broadcast transaction is detected as mined.
callback_discovery_process_complete
- The callback function pointer matching the function signature. This will be
called when a send_transacion(..)
call is made to a peer whose address is not known and a discovery process must
be conducted. The outcome of the discovery process is relayed via this callback
callback_base_node_sync_complete
- The callback function pointer matching the function signature. This is called
when a Base Node Sync process is completed or times out. The request_key is used to identify which request this
callback references and a result of true means it was successful and false that the process timed out and new one
will be started
callback_saf_message_received
- The callback function pointer that will be called when the Dht has determined that
is has connected to enough of its neighbours to be confident that it has received any SAF messages that were waiting
for it.
error_out
- Pointer to an int which will be modified
to an error code should one occur, may not be null. Functions as an out parameter.
Returns
*mut TariWallet
- Returns a pointer to a TariWallet, note that it returns ptr::null_mut()
if config is null, a wallet error was encountered or if the runtime could not be created
Safety
The wallet_destroy
method must be called when finished with a TariWallet to prevent a memory leak