Skip to content

Commit 1463355

Browse files
committed
updated dash-spv-ffi/FFI_API.md docs
1 parent e14011a commit 1463355

File tree

1 file changed

+139
-3
lines changed

1 file changed

+139
-3
lines changed

dash-spv-ffi/FFI_API.md

Lines changed: 139 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This document provides a comprehensive reference for all FFI (Foreign Function I
44

55
**Auto-generated**: This documentation is automatically generated from the source code. Do not edit manually.
66

7-
**Total Functions**: 71
7+
**Total Functions**: 79
88

99
## Table of Contents
1010

@@ -91,11 +91,13 @@ Functions: 1
9191

9292
### Transaction Management
9393

94-
Functions: 3
94+
Functions: 5
9595

9696
| Function | Description | Module |
9797
|----------|-------------|--------|
9898
| `dash_spv_ffi_client_broadcast_transaction` | No description | broadcast |
99+
| `dash_spv_ffi_client_get_blocks_with_transactions_count` | Get the count of blocks that contained relevant transactions | client |
100+
| `dash_spv_ffi_client_get_transaction_count` | Get the total count of transactions across all wallets | client |
99101
| `dash_spv_ffi_unconfirmed_transaction_destroy` | Destroys an FFIUnconfirmedTransaction and all its associated resources # Saf... | types |
100102
| `dash_spv_ffi_unconfirmed_transaction_destroy_raw_tx` | Destroys the raw transaction bytes allocated for an FFIUnconfirmedTransaction... | types |
101103

@@ -138,7 +140,7 @@ Functions: 2
138140

139141
### Utility Functions
140142

141-
Functions: 19
143+
Functions: 25
142144

143145
| Function | Description | Module |
144146
|----------|-------------|--------|
@@ -148,13 +150,19 @@ Functions: 19
148150
| `dash_spv_ffi_checkpoint_latest` | Get the latest checkpoint for the given network | checkpoints |
149151
| `dash_spv_ffi_checkpoints_between_heights` | Get all checkpoints between two heights (inclusive) | checkpoints |
150152
| `dash_spv_ffi_client_clear_storage` | Clear all persisted SPV storage (headers, filters, metadata, sync state) | client |
153+
| `dash_spv_ffi_client_get_filter_matched_heights` | Get filter matched heights with wallet IDs in a given range | client |
151154
| `dash_spv_ffi_client_get_stats` | Get current runtime statistics for the SPV client | client |
152155
| `dash_spv_ffi_client_get_tip_hash` | Get the current chain tip hash (32 bytes) if available | client |
153156
| `dash_spv_ffi_client_get_tip_height` | Get the current chain tip height (absolute) | client |
154157
| `dash_spv_ffi_client_get_wallet_manager` | Get the wallet manager from the SPV client Returns a pointer to an `FFIWalle... | client |
158+
| `dash_spv_ffi_client_load_filters` | Load compact block filters in a given height range | client |
155159
| `dash_spv_ffi_client_record_send` | Record that we attempted to send a transaction by its txid | client |
156160
| `dash_spv_ffi_client_rescan_blockchain` | Request a rescan of the blockchain from a given height (not yet implemented) | client |
161+
| `dash_spv_ffi_compact_filter_destroy` | Destroys a single compact filter | types |
162+
| `dash_spv_ffi_compact_filters_destroy` | Destroys an array of compact filters | types |
157163
| `dash_spv_ffi_enable_test_mode` | No description | utils |
164+
| `dash_spv_ffi_filter_match_entry_destroy` | Destroys a single filter match entry | types |
165+
| `dash_spv_ffi_filter_matches_destroy` | Destroys an array of filter match entries | types |
158166
| `dash_spv_ffi_init_logging` | Initialize logging for the SPV library | utils |
159167
| `dash_spv_ffi_spv_stats_destroy` | Destroy an `FFISpvStats` object returned by this crate | client |
160168
| `dash_spv_ffi_string_array_destroy` | Destroy an array of FFIString pointers (Vec<*mut FFIString>) and their contents | types |
@@ -806,6 +814,38 @@ dash_spv_ffi_client_broadcast_transaction(client: *mut FFIDashSpvClient, tx_hex:
806814

807815
---
808816

817+
#### `dash_spv_ffi_client_get_blocks_with_transactions_count`
818+
819+
```c
820+
dash_spv_ffi_client_get_blocks_with_transactions_count(client: *mut FFIDashSpvClient,) -> usize
821+
```
822+
823+
**Description:**
824+
Get the count of blocks that contained relevant transactions. This counts unique block heights from the wallet's transaction history, representing how many blocks actually had transactions for the user's wallets. This is a persistent metric that survives app restarts. # Parameters - `client`: Valid pointer to an FFIDashSpvClient # Returns - Count of blocks with transactions (0 or higher) - Returns 0 if client not initialized or wallet not available # Safety - `client` must be a valid, non-null pointer
825+
826+
**Safety:**
827+
- `client` must be a valid, non-null pointer
828+
829+
**Module:** `client`
830+
831+
---
832+
833+
#### `dash_spv_ffi_client_get_transaction_count`
834+
835+
```c
836+
dash_spv_ffi_client_get_transaction_count(client: *mut FFIDashSpvClient,) -> usize
837+
```
838+
839+
**Description:**
840+
Get the total count of transactions across all wallets. This returns the persisted transaction count from the wallet, not the ephemeral sync statistics. Use this to show how many blocks contained relevant transactions for the user's wallets. # Parameters - `client`: Valid pointer to an FFIDashSpvClient # Returns - Transaction count (0 or higher) - Returns 0 if client not initialized or wallet not available # Safety - `client` must be a valid, non-null pointer
841+
842+
**Safety:**
843+
- `client` must be a valid, non-null pointer
844+
845+
**Module:** `client`
846+
847+
---
848+
809849
#### `dash_spv_ffi_unconfirmed_transaction_destroy`
810850

811851
```c
@@ -1067,6 +1107,22 @@ Clear all persisted SPV storage (headers, filters, metadata, sync state). # Saf
10671107

10681108
---
10691109

1110+
#### `dash_spv_ffi_client_get_filter_matched_heights`
1111+
1112+
```c
1113+
dash_spv_ffi_client_get_filter_matched_heights(client: *mut FFIDashSpvClient, start_height: u32, end_height: u32,) -> *mut crate::types::FFIFilterMatches
1114+
```
1115+
1116+
**Description:**
1117+
Get filter matched heights with wallet IDs in a given range. Returns an `FFIFilterMatches` struct containing all heights where filters matched and the wallet IDs that matched at each height. The caller must free the result using `dash_spv_ffi_filter_matches_destroy`. # Parameters - `client`: Valid pointer to an FFIDashSpvClient - `start_height`: Starting block height (inclusive) - `end_height`: Ending block height (exclusive) # Limits - Maximum range size: 10,000 blocks - If `end_height - start_height > 10000`, an error is returned # Returns - Non-null pointer to FFIFilterMatches on success - Null pointer on error (check `dash_spv_ffi_get_last_error`) # Safety - `client` must be a valid, non-null pointer - Caller must call `dash_spv_ffi_filter_matches_destroy` on the returned pointer
1118+
1119+
**Safety:**
1120+
- `client` must be a valid, non-null pointer - Caller must call `dash_spv_ffi_filter_matches_destroy` on the returned pointer
1121+
1122+
**Module:** `client`
1123+
1124+
---
1125+
10701126
#### `dash_spv_ffi_client_get_stats`
10711127
10721128
```c
@@ -1131,6 +1187,22 @@ The caller must ensure that: - The client pointer is valid - The returned pointe
11311187
11321188
---
11331189
1190+
#### `dash_spv_ffi_client_load_filters`
1191+
1192+
```c
1193+
dash_spv_ffi_client_load_filters(client: *mut FFIDashSpvClient, start_height: u32, end_height: u32,) -> *mut crate::types::FFICompactFilters
1194+
```
1195+
1196+
**Description:**
1197+
Load compact block filters in a given height range. Returns an `FFICompactFilters` struct containing all filters that exist in the range. Missing filters are skipped. The caller must free the result using `dash_spv_ffi_compact_filters_destroy`. # Parameters - `client`: Valid pointer to an FFIDashSpvClient - `start_height`: Starting block height (inclusive) - `end_height`: Ending block height (exclusive) # Limits - Maximum range size: 10,000 blocks - If `end_height - start_height > 10000`, an error is returned # Returns - Non-null pointer to FFICompactFilters on success - Null pointer on error (check `dash_spv_ffi_get_last_error`) # Safety - `client` must be a valid, non-null pointer - Caller must call `dash_spv_ffi_compact_filters_destroy` on the returned pointer
1198+
1199+
**Safety:**
1200+
- `client` must be a valid, non-null pointer - Caller must call `dash_spv_ffi_compact_filters_destroy` on the returned pointer
1201+
1202+
**Module:** `client`
1203+
1204+
---
1205+
11341206
#### `dash_spv_ffi_client_record_send`
11351207

11361208
```c
@@ -1163,6 +1235,38 @@ Request a rescan of the blockchain from a given height (not yet implemented). #
11631235

11641236
---
11651237

1238+
#### `dash_spv_ffi_compact_filter_destroy`
1239+
1240+
```c
1241+
dash_spv_ffi_compact_filter_destroy(filter: *mut FFICompactFilter) -> ()
1242+
```
1243+
1244+
**Description:**
1245+
Destroys a single compact filter. # Safety - `filter` must be a valid pointer to an FFICompactFilter - The pointer must not be used after this function is called - This function should only be called once per allocation
1246+
1247+
**Safety:**
1248+
- `filter` must be a valid pointer to an FFICompactFilter - The pointer must not be used after this function is called - This function should only be called once per allocation
1249+
1250+
**Module:** `types`
1251+
1252+
---
1253+
1254+
#### `dash_spv_ffi_compact_filters_destroy`
1255+
1256+
```c
1257+
dash_spv_ffi_compact_filters_destroy(filters: *mut FFICompactFilters) -> ()
1258+
```
1259+
1260+
**Description:**
1261+
Destroys an array of compact filters. # Safety - `filters` must be a valid pointer to an FFICompactFilters struct - The pointer must not be used after this function is called - This function should only be called once per allocation
1262+
1263+
**Safety:**
1264+
- `filters` must be a valid pointer to an FFICompactFilters struct - The pointer must not be used after this function is called - This function should only be called once per allocation
1265+
1266+
**Module:** `types`
1267+
1268+
---
1269+
11661270
#### `dash_spv_ffi_enable_test_mode`
11671271

11681272
```c
@@ -1173,6 +1277,38 @@ dash_spv_ffi_enable_test_mode() -> ()
11731277

11741278
---
11751279

1280+
#### `dash_spv_ffi_filter_match_entry_destroy`
1281+
1282+
```c
1283+
dash_spv_ffi_filter_match_entry_destroy(entry: *mut FFIFilterMatchEntry) -> ()
1284+
```
1285+
1286+
**Description:**
1287+
Destroys a single filter match entry. # Safety - `entry` must be a valid pointer to an FFIFilterMatchEntry - The pointer must not be used after this function is called - This function should only be called once per allocation
1288+
1289+
**Safety:**
1290+
- `entry` must be a valid pointer to an FFIFilterMatchEntry - The pointer must not be used after this function is called - This function should only be called once per allocation
1291+
1292+
**Module:** `types`
1293+
1294+
---
1295+
1296+
#### `dash_spv_ffi_filter_matches_destroy`
1297+
1298+
```c
1299+
dash_spv_ffi_filter_matches_destroy(matches: *mut FFIFilterMatches) -> ()
1300+
```
1301+
1302+
**Description:**
1303+
Destroys an array of filter match entries. # Safety - `matches` must be a valid pointer to an FFIFilterMatches struct - The pointer must not be used after this function is called - This function should only be called once per allocation
1304+
1305+
**Safety:**
1306+
- `matches` must be a valid pointer to an FFIFilterMatches struct - The pointer must not be used after this function is called - This function should only be called once per allocation
1307+
1308+
**Module:** `types`
1309+
1310+
---
1311+
11761312
#### `dash_spv_ffi_init_logging`
11771313

11781314
```c

0 commit comments

Comments
 (0)