@@ -9,13 +9,6 @@ typedef enum FFIMempoolStrategy {
99 Selective = 2 ,
1010} FFIMempoolStrategy ;
1111
12- typedef enum FFINetwork {
13- Dash = 0 ,
14- Testnet = 1 ,
15- Regtest = 2 ,
16- Devnet = 3 ,
17- } FFINetwork ;
18-
1912typedef enum FFISyncStage {
2013 Connecting = 0 ,
2114 QueryingHeight = 1 ,
@@ -342,54 +335,211 @@ int32_t dash_spv_ffi_client_record_send(struct FFIDashSpvClient *client, const c
342335 */
343336void * dash_spv_ffi_client_get_wallet_manager (struct FFIDashSpvClient * client );
344337
345- FFIClientConfig * dash_spv_ffi_config_new (enum FFINetwork network );
338+ FFIClientConfig * dash_spv_ffi_config_new (FFINetwork network );
346339
347340FFIClientConfig * dash_spv_ffi_config_mainnet (void );
348341
349342FFIClientConfig * dash_spv_ffi_config_testnet (void );
350343
351- int32_t dash_spv_ffi_config_set_data_dir (FFIClientConfig * config , const char * path );
344+ /**
345+ * Sets the data directory for storing blockchain data
346+ *
347+ * # Safety
348+ * - `config` must be a valid pointer to an FFIClientConfig created by dash_spv_ffi_config_new/mainnet/testnet
349+ * - `path` must be a valid null-terminated C string
350+ * - The caller must ensure the config pointer remains valid for the duration of this call
351+ */
352+ int32_t dash_spv_ffi_config_set_data_dir (FFIClientConfig * config ,
353+ const char * path );
352354
355+ /**
356+ * Sets the validation mode for the SPV client
357+ *
358+ * # Safety
359+ * - `config` must be a valid pointer to an FFIClientConfig created by dash_spv_ffi_config_new/mainnet/testnet
360+ * - The caller must ensure the config pointer remains valid for the duration of this call
361+ */
353362int32_t dash_spv_ffi_config_set_validation_mode (FFIClientConfig * config ,
354363 enum FFIValidationMode mode );
355364
356- int32_t dash_spv_ffi_config_set_max_peers (FFIClientConfig * config , uint32_t max_peers );
365+ /**
366+ * Sets the maximum number of peers to connect to
367+ *
368+ * # Safety
369+ * - `config` must be a valid pointer to an FFIClientConfig created by dash_spv_ffi_config_new/mainnet/testnet
370+ * - The caller must ensure the config pointer remains valid for the duration of this call
371+ */
372+ int32_t dash_spv_ffi_config_set_max_peers (FFIClientConfig * config ,
373+ uint32_t max_peers );
357374
358- int32_t dash_spv_ffi_config_add_peer (FFIClientConfig * config , const char * addr );
375+ /**
376+ * Adds a peer address to the configuration
377+ *
378+ * # Safety
379+ * - `config` must be a valid pointer to an FFIClientConfig created by dash_spv_ffi_config_new/mainnet/testnet
380+ * - `addr` must be a valid null-terminated C string containing a socket address (e.g., "192.168.1.1:9999")
381+ * - The caller must ensure both pointers remain valid for the duration of this call
382+ */
383+ int32_t dash_spv_ffi_config_add_peer (FFIClientConfig * config ,
384+ const char * addr );
359385
360- int32_t dash_spv_ffi_config_set_user_agent (FFIClientConfig * config , const char * user_agent );
386+ /**
387+ * Sets the user agent string (currently not supported)
388+ *
389+ * # Safety
390+ * - `config` must be a valid pointer to an FFIClientConfig created by dash_spv_ffi_config_new/mainnet/testnet
391+ * - `user_agent` must be a valid null-terminated C string
392+ * - The caller must ensure both pointers remain valid for the duration of this call
393+ */
394+ int32_t dash_spv_ffi_config_set_user_agent (FFIClientConfig * config ,
395+ const char * user_agent );
361396
362- int32_t dash_spv_ffi_config_set_relay_transactions (FFIClientConfig * config , bool _relay );
397+ /**
398+ * Sets whether to relay transactions (currently a no-op)
399+ *
400+ * # Safety
401+ * - `config` must be a valid pointer to an FFIClientConfig created by dash_spv_ffi_config_new/mainnet/testnet
402+ * - The caller must ensure the config pointer remains valid for the duration of this call
403+ */
404+ int32_t dash_spv_ffi_config_set_relay_transactions (FFIClientConfig * config ,
405+ bool _relay );
363406
364- int32_t dash_spv_ffi_config_set_filter_load (FFIClientConfig * config , bool load_filters );
407+ /**
408+ * Sets whether to load bloom filters
409+ *
410+ * # Safety
411+ * - `config` must be a valid pointer to an FFIClientConfig created by dash_spv_ffi_config_new/mainnet/testnet
412+ * - The caller must ensure the config pointer remains valid for the duration of this call
413+ */
414+ int32_t dash_spv_ffi_config_set_filter_load (FFIClientConfig * config ,
415+ bool load_filters );
365416
366- enum FFINetwork dash_spv_ffi_config_get_network (const FFIClientConfig * config );
417+ /**
418+ * Gets the network type from the configuration
419+ *
420+ * # Safety
421+ * - `config` must be a valid pointer to an FFIClientConfig or null
422+ * - If null, returns FFINetwork::Dash as default
423+ */
424+ FFINetwork dash_spv_ffi_config_get_network (const FFIClientConfig * config );
367425
426+ /**
427+ * Gets the data directory path from the configuration
428+ *
429+ * # Safety
430+ * - `config` must be a valid pointer to an FFIClientConfig or null
431+ * - If null or no data directory is set, returns an FFIString with null pointer
432+ * - The returned FFIString must be freed by the caller using dash_string_free
433+ */
368434struct FFIString dash_spv_ffi_config_get_data_dir (const FFIClientConfig * config );
369435
436+ /**
437+ * Destroys an FFIClientConfig and frees its memory
438+ *
439+ * # Safety
440+ * - `config` must be a valid pointer to an FFIClientConfig created by dash_spv_ffi_config_new/mainnet/testnet, or null
441+ * - After calling this function, the config pointer becomes invalid and must not be used
442+ * - This function should only be called once per config instance
443+ */
370444void dash_spv_ffi_config_destroy (FFIClientConfig * config );
371445
372- int32_t dash_spv_ffi_config_set_mempool_tracking (FFIClientConfig * config , bool enable );
446+ /**
447+ * Enables or disables mempool tracking
448+ *
449+ * # Safety
450+ * - `config` must be a valid pointer to an FFIClientConfig created by dash_spv_ffi_config_new/mainnet/testnet
451+ * - The caller must ensure the config pointer remains valid for the duration of this call
452+ */
453+ int32_t dash_spv_ffi_config_set_mempool_tracking (FFIClientConfig * config ,
454+ bool enable );
373455
456+ /**
457+ * Sets the mempool synchronization strategy
458+ *
459+ * # Safety
460+ * - `config` must be a valid pointer to an FFIClientConfig created by dash_spv_ffi_config_new/mainnet/testnet
461+ * - The caller must ensure the config pointer remains valid for the duration of this call
462+ */
374463int32_t dash_spv_ffi_config_set_mempool_strategy (FFIClientConfig * config ,
375464 enum FFIMempoolStrategy strategy );
376465
466+ /**
467+ * Sets the maximum number of mempool transactions to track
468+ *
469+ * # Safety
470+ * - `config` must be a valid pointer to an FFIClientConfig created by dash_spv_ffi_config_new/mainnet/testnet
471+ * - The caller must ensure the config pointer remains valid for the duration of this call
472+ */
377473int32_t dash_spv_ffi_config_set_max_mempool_transactions (FFIClientConfig * config ,
378474 uint32_t max_transactions );
379475
380- int32_t dash_spv_ffi_config_set_mempool_timeout (FFIClientConfig * config , uint64_t timeout_secs );
476+ /**
477+ * Sets the mempool transaction timeout in seconds
478+ *
479+ * # Safety
480+ * - `config` must be a valid pointer to an FFIClientConfig created by dash_spv_ffi_config_new/mainnet/testnet
481+ * - The caller must ensure the config pointer remains valid for the duration of this call
482+ */
483+ int32_t dash_spv_ffi_config_set_mempool_timeout (FFIClientConfig * config ,
484+ uint64_t timeout_secs );
381485
382- int32_t dash_spv_ffi_config_set_fetch_mempool_transactions (FFIClientConfig * config , bool fetch );
486+ /**
487+ * Sets whether to fetch full mempool transaction data
488+ *
489+ * # Safety
490+ * - `config` must be a valid pointer to an FFIClientConfig created by dash_spv_ffi_config_new/mainnet/testnet
491+ * - The caller must ensure the config pointer remains valid for the duration of this call
492+ */
493+ int32_t dash_spv_ffi_config_set_fetch_mempool_transactions (FFIClientConfig * config ,
494+ bool fetch );
383495
384- int32_t dash_spv_ffi_config_set_persist_mempool (FFIClientConfig * config , bool persist );
496+ /**
497+ * Sets whether to persist mempool state to disk
498+ *
499+ * # Safety
500+ * - `config` must be a valid pointer to an FFIClientConfig created by dash_spv_ffi_config_new/mainnet/testnet
501+ * - The caller must ensure the config pointer remains valid for the duration of this call
502+ */
503+ int32_t dash_spv_ffi_config_set_persist_mempool (FFIClientConfig * config ,
504+ bool persist );
385505
506+ /**
507+ * Gets whether mempool tracking is enabled
508+ *
509+ * # Safety
510+ * - `config` must be a valid pointer to an FFIClientConfig or null
511+ * - If null, returns false as default
512+ */
386513bool dash_spv_ffi_config_get_mempool_tracking (const FFIClientConfig * config );
387514
515+ /**
516+ * Gets the mempool synchronization strategy
517+ *
518+ * # Safety
519+ * - `config` must be a valid pointer to an FFIClientConfig or null
520+ * - If null, returns FFIMempoolStrategy::Selective as default
521+ */
388522enum FFIMempoolStrategy dash_spv_ffi_config_get_mempool_strategy (const FFIClientConfig * config );
389523
390- int32_t dash_spv_ffi_config_set_start_from_height (FFIClientConfig * config , uint32_t height );
524+ /**
525+ * Sets the starting block height for synchronization
526+ *
527+ * # Safety
528+ * - `config` must be a valid pointer to an FFIClientConfig created by dash_spv_ffi_config_new/mainnet/testnet
529+ * - The caller must ensure the config pointer remains valid for the duration of this call
530+ */
531+ int32_t dash_spv_ffi_config_set_start_from_height (FFIClientConfig * config ,
532+ uint32_t height );
391533
392- int32_t dash_spv_ffi_config_set_wallet_creation_time (FFIClientConfig * config , uint32_t timestamp );
534+ /**
535+ * Sets the wallet creation timestamp for synchronization optimization
536+ *
537+ * # Safety
538+ * - `config` must be a valid pointer to an FFIClientConfig created by dash_spv_ffi_config_new/mainnet/testnet
539+ * - The caller must ensure the config pointer remains valid for the duration of this call
540+ */
541+ int32_t dash_spv_ffi_config_set_wallet_creation_time (FFIClientConfig * config ,
542+ uint32_t timestamp );
393543
394544const char * dash_spv_ffi_get_last_error (void );
395545
@@ -503,8 +653,6 @@ int32_t dash_spv_ffi_init_logging(const char *level);
503653
504654const char * dash_spv_ffi_version (void );
505655
506- const char * dash_spv_ffi_get_network_name (enum FFINetwork network );
507-
508656void dash_spv_ffi_enable_test_mode (void );
509657
510658int32_t dash_spv_ffi_client_broadcast_transaction (struct FFIDashSpvClient * client ,
0 commit comments