/*! \file */ /******************************************* * * * File auto-generated by `::safer_ffi`. * * * * Do not manually edit this file. * * * *******************************************/ #ifndef __RUST_BDK_FFI__ #define __RUST_BDK_FFI__ #ifdef __cplusplus extern "C" { #endif typedef struct DatabaseConfig DatabaseConfig_t; DatabaseConfig_t * new_memory_config (void); DatabaseConfig_t * new_sled_config ( char const * path, char const * tree_name); void free_database_config ( DatabaseConfig_t * database_config); #include #include /** \remark Has the same ABI as `uint16_t` **/ #ifdef DOXYGEN typedef enum FfiError #else typedef uint16_t FfiError_t; enum #endif { /** . */ FFI_ERROR_NONE, /** . */ FFI_ERROR_INVALID_U32_BYTES, /** . */ FFI_ERROR_GENERIC, /** . */ FFI_ERROR_SCRIPT_DOESNT_HAVE_ADDRESS_FORM, /** . */ FFI_ERROR_NO_RECIPIENTS, /** . */ FFI_ERROR_NO_UTXOS_SELECTED, /** . */ FFI_ERROR_OUTPUT_BELOW_DUST_LIMIT, /** . */ FFI_ERROR_INSUFFICIENT_FUNDS, /** . */ FFI_ERROR_BN_B_TOTAL_TRIES_EXCEEDED, /** . */ FFI_ERROR_BN_B_NO_EXACT_MATCH, /** . */ FFI_ERROR_UNKNOWN_UTXO, /** . */ FFI_ERROR_TRANSACTION_NOT_FOUND, /** . */ FFI_ERROR_TRANSACTION_CONFIRMED, /** . */ FFI_ERROR_IRREPLACEABLE_TRANSACTION, /** . */ FFI_ERROR_FEE_RATE_TOO_LOW, /** . */ FFI_ERROR_FEE_TOO_LOW, /** . */ FFI_ERROR_FEE_RATE_UNAVAILABLE, /** . */ FFI_ERROR_MISSING_KEY_ORIGIN, /** . */ FFI_ERROR_KEY, /** . */ FFI_ERROR_CHECKSUM_MISMATCH, /** . */ FFI_ERROR_SPENDING_POLICY_REQUIRED, /** . */ FFI_ERROR_INVALID_POLICY_PATH_ERROR, /** . */ FFI_ERROR_SIGNER, /** . */ FFI_ERROR_INVALID_NETWORK, /** . */ FFI_ERROR_INVALID_PROGRESS_VALUE, /** . */ FFI_ERROR_PROGRESS_UPDATE_ERROR, /** . */ FFI_ERROR_INVALID_OUTPOINT, /** . */ FFI_ERROR_DESCRIPTOR, /** . */ FFI_ERROR_ADDRESS_VALIDATOR, /** . */ FFI_ERROR_ENCODE, /** . */ FFI_ERROR_MINISCRIPT, /** . */ FFI_ERROR_BIP32, /** . */ FFI_ERROR_SECP256K1, /** . */ FFI_ERROR_JSON, /** . */ FFI_ERROR_HEX, /** . */ FFI_ERROR_PSBT, /** . */ FFI_ERROR_PSBT_PARSE, /** . */ FFI_ERROR_ELECTRUM, /** . */ FFI_ERROR_SLED, } #ifdef DOXYGEN FfiError_t #endif ; typedef struct { char * ok; FfiError_t err; } FfiResult_char_ptr_t; void free_string_result ( FfiResult_char_ptr_t string_result); typedef struct { FfiError_t err; } FfiResultVoid_t; void free_void_result ( FfiResultVoid_t void_result); typedef struct { uint64_t ok; FfiError_t err; } FfiResult_uint64_t; void free_uint64_result ( FfiResult_uint64_t void_result); /** \brief * Free a Rust-allocated string */ void free_string ( char * string); typedef struct BlockchainConfig BlockchainConfig_t; typedef struct OpaqueWallet OpaqueWallet_t; typedef struct { OpaqueWallet_t * ok; FfiError_t err; } FfiResult_OpaqueWallet_ptr_t; FfiResult_OpaqueWallet_ptr_t new_wallet_result ( char const * descriptor, char const * change_descriptor, char const * network, BlockchainConfig_t const * blockchain_config, DatabaseConfig_t const * database_config); void free_wallet_result ( FfiResult_OpaqueWallet_ptr_t wallet_result); FfiResultVoid_t sync_wallet ( OpaqueWallet_t const * opaque_wallet); FfiResult_char_ptr_t new_address ( OpaqueWallet_t const * opaque_wallet); typedef struct { char * txid; uint32_t vout; } OutPoint_t; typedef struct { uint64_t value; char * script_pubkey; } TxOut_t; typedef struct { OutPoint_t outpoint; TxOut_t txout; uint16_t keychain; } LocalUtxo_t; /** \brief * Same as [`Vec`][`rust::Vec`], but with guaranteed `#[repr(C)]` layout */ typedef struct { LocalUtxo_t * ptr; size_t len; size_t cap; } Vec_LocalUtxo_t; typedef struct { Vec_LocalUtxo_t ok; FfiError_t err; } FfiResult_Vec_LocalUtxo_t; FfiResult_Vec_LocalUtxo_t list_unspent ( OpaqueWallet_t const * opaque_wallet); void free_veclocalutxo_result ( FfiResult_Vec_LocalUtxo_t unspent_result); FfiResult_uint64_t balance ( OpaqueWallet_t const * opaque_wallet); #include typedef struct { uint32_t height; uint64_t timestamp; } ConfirmationTime_t; typedef struct { char * txid; uint64_t received; uint64_t sent; int64_t fee; bool is_confirmed; ConfirmationTime_t confirmation_time; bool verified; } TransactionDetails_t; /** \brief * Same as [`Vec`][`rust::Vec`], but with guaranteed `#[repr(C)]` layout */ typedef struct { TransactionDetails_t * ptr; size_t len; size_t cap; } Vec_TransactionDetails_t; typedef struct { Vec_TransactionDetails_t ok; FfiError_t err; } FfiResult_Vec_TransactionDetails_t; FfiResult_Vec_TransactionDetails_t list_transactions ( OpaqueWallet_t const * opaque_wallet); void free_vectxdetails_result ( FfiResult_Vec_TransactionDetails_t txdetails_result); BlockchainConfig_t * new_electrum_config ( char const * url, char const * socks5, int16_t retry, int16_t timeout, size_t stop_gap); void free_blockchain_config ( BlockchainConfig_t * blockchain_config); #ifdef __cplusplus } /* extern "C" */ #endif #endif /* __RUST_BDK_FFI__ */