Skip to content

Commit 50e36ef

Browse files
ffi docs
1 parent 87560ea commit 50e36ef

File tree

1 file changed

+99
-15
lines changed

1 file changed

+99
-15
lines changed

dash-spv-ffi/FFI_API.md

Lines changed: 99 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ Functions: 4
2727

2828
| Function | Description | Module |
2929
|----------|-------------|--------|
30-
| `dash_spv_ffi_client_destroy` | No description | client |
31-
| `dash_spv_ffi_client_new` | No description | client |
32-
| `dash_spv_ffi_client_start` | No description | client |
33-
| `dash_spv_ffi_client_stop` | No description | client |
30+
| `dash_spv_ffi_client_destroy` | Destroy the client and free associated resources | client |
31+
| `dash_spv_ffi_client_new` | Create a new SPV client and return an opaque pointer | client |
32+
| `dash_spv_ffi_client_start` | Start the SPV client | client |
33+
| `dash_spv_ffi_client_stop` | Stop the SPV client | client |
3434

3535
### Configuration
3636

@@ -71,12 +71,12 @@ Functions: 7
7171
| Function | Description | Module |
7272
|----------|-------------|--------|
7373
| `dash_spv_ffi_client_cancel_sync` | Cancels the sync operation | client |
74-
| `dash_spv_ffi_client_get_sync_progress` | No description | client |
75-
| `dash_spv_ffi_client_is_filter_sync_available` | No description | client |
74+
| `dash_spv_ffi_client_get_sync_progress` | Get the current sync progress snapshot | client |
75+
| `dash_spv_ffi_client_is_filter_sync_available` | Check if compact filter sync is currently available | client |
7676
| `dash_spv_ffi_client_sync_to_tip` | Sync the SPV client to the chain tip | client |
7777
| `dash_spv_ffi_client_sync_to_tip_with_progress` | Sync the SPV client to the chain tip with detailed progress updates | client |
7878
| `dash_spv_ffi_client_test_sync` | Performs a test synchronization of the SPV client # Parameters - `client`: P... | client |
79-
| `dash_spv_ffi_sync_progress_destroy` | No description | client |
79+
| `dash_spv_ffi_sync_progress_destroy` | Destroy a `FFISyncProgress` object returned by this crate | client |
8080

8181
### Address Monitoring
8282

@@ -102,7 +102,7 @@ Functions: 1
102102

103103
| Function | Description | Module |
104104
|----------|-------------|--------|
105-
| `dash_spv_ffi_client_enable_mempool_tracking` | No description | client |
105+
| `dash_spv_ffi_client_enable_mempool_tracking` | Enable mempool tracking with a given strategy | client |
106106

107107
### Platform Integration
108108

@@ -121,7 +121,7 @@ Functions: 1
121121

122122
| Function | Description | Module |
123123
|----------|-------------|--------|
124-
| `dash_spv_ffi_client_set_event_callbacks` | No description | client |
124+
| `dash_spv_ffi_client_set_event_callbacks` | Set event callbacks for the client | client |
125125

126126
### Error Handling
127127

@@ -143,13 +143,13 @@ Functions: 15
143143
| `dash_spv_ffi_checkpoint_before_timestamp` | Get the last checkpoint at or before a given UNIX timestamp (seconds) | checkpoints |
144144
| `dash_spv_ffi_checkpoint_latest` | Get the latest checkpoint for the given network | checkpoints |
145145
| `dash_spv_ffi_checkpoints_between_heights` | Get all checkpoints between two heights (inclusive) | checkpoints |
146-
| `dash_spv_ffi_client_get_stats` | No description | client |
146+
| `dash_spv_ffi_client_get_stats` | Get current runtime statistics for the SPV client | client |
147147
| `dash_spv_ffi_client_get_wallet_manager` | Get the wallet manager from the SPV client Returns an opaque pointer to FFIW... | client |
148-
| `dash_spv_ffi_client_record_send` | No description | client |
149-
| `dash_spv_ffi_client_rescan_blockchain` | No description | client |
148+
| `dash_spv_ffi_client_record_send` | Record that we attempted to send a transaction by its txid | client |
149+
| `dash_spv_ffi_client_rescan_blockchain` | Request a rescan of the blockchain from a given height (not yet implemented) | client |
150150
| `dash_spv_ffi_enable_test_mode` | No description | utils |
151-
| `dash_spv_ffi_init_logging` | No description | utils |
152-
| `dash_spv_ffi_spv_stats_destroy` | No description | client |
151+
| `dash_spv_ffi_init_logging` | Initialize logging for the SPV library | utils |
152+
| `dash_spv_ffi_spv_stats_destroy` | Destroy an `FFISpvStats` object returned by this crate | client |
153153
| `dash_spv_ffi_string_array_destroy` | Destroy an array of FFIString pointers (Vec<*mut FFIString>) and their contents | types |
154154
| `dash_spv_ffi_string_destroy` | No description | types |
155155
| `dash_spv_ffi_version` | No description | utils |
@@ -164,6 +164,12 @@ Functions: 15
164164
dash_spv_ffi_client_destroy(client: *mut FFIDashSpvClient) -> ()
165165
```
166166
167+
**Description:**
168+
Destroy the client and free associated resources. # Safety - `client` must be either null or a pointer obtained from `dash_spv_ffi_client_new`.
169+
170+
**Safety:**
171+
- `client` must be either null or a pointer obtained from `dash_spv_ffi_client_new`.
172+
167173
**Module:** `client`
168174
169175
---
@@ -174,6 +180,12 @@ dash_spv_ffi_client_destroy(client: *mut FFIDashSpvClient) -> ()
174180
dash_spv_ffi_client_new(config: *const FFIClientConfig,) -> *mut FFIDashSpvClient
175181
```
176182

183+
**Description:**
184+
Create a new SPV client and return an opaque pointer. # Safety - `config` must be a valid, non-null pointer for the duration of the call. - The returned pointer must be freed with `dash_spv_ffi_client_destroy`.
185+
186+
**Safety:**
187+
- `config` must be a valid, non-null pointer for the duration of the call. - The returned pointer must be freed with `dash_spv_ffi_client_destroy`.
188+
177189
**Module:** `client`
178190

179191
---
@@ -184,6 +196,12 @@ dash_spv_ffi_client_new(config: *const FFIClientConfig,) -> *mut FFIDashSpvClien
184196
dash_spv_ffi_client_start(client: *mut FFIDashSpvClient) -> i32
185197
```
186198
199+
**Description:**
200+
Start the SPV client. # Safety - `client` must be a valid, non-null pointer to a created client.
201+
202+
**Safety:**
203+
- `client` must be a valid, non-null pointer to a created client.
204+
187205
**Module:** `client`
188206
189207
---
@@ -194,6 +212,12 @@ dash_spv_ffi_client_start(client: *mut FFIDashSpvClient) -> i32
194212
dash_spv_ffi_client_stop(client: *mut FFIDashSpvClient) -> i32
195213
```
196214

215+
**Description:**
216+
Stop the SPV client. # Safety - `client` must be a valid, non-null pointer to a created client.
217+
218+
**Safety:**
219+
- `client` must be a valid, non-null pointer to a created client.
220+
197221
**Module:** `client`
198222

199223
---
@@ -606,6 +630,12 @@ The client pointer must be valid and non-null.
606630
dash_spv_ffi_client_get_sync_progress(client: *mut FFIDashSpvClient,) -> *mut FFISyncProgress
607631
```
608632

633+
**Description:**
634+
Get the current sync progress snapshot. # Safety - `client` must be a valid, non-null pointer.
635+
636+
**Safety:**
637+
- `client` must be a valid, non-null pointer.
638+
609639
**Module:** `client`
610640

611641
---
@@ -616,6 +646,12 @@ dash_spv_ffi_client_get_sync_progress(client: *mut FFIDashSpvClient,) -> *mut FF
616646
dash_spv_ffi_client_is_filter_sync_available(client: *mut FFIDashSpvClient,) -> bool
617647
```
618648
649+
**Description:**
650+
Check if compact filter sync is currently available. # Safety - `client` must be a valid, non-null pointer.
651+
652+
**Safety:**
653+
- `client` must be a valid, non-null pointer.
654+
619655
**Module:** `client`
620656
621657
---
@@ -674,6 +710,12 @@ This function is unsafe because it dereferences a raw pointer. The caller must e
674710
dash_spv_ffi_sync_progress_destroy(progress: *mut FFISyncProgress) -> ()
675711
```
676712
713+
**Description:**
714+
Destroy a `FFISyncProgress` object returned by this crate. # Safety - `progress` must be a pointer returned from this crate, or null.
715+
716+
**Safety:**
717+
- `progress` must be a pointer returned from this crate, or null.
718+
677719
**Module:** `client`
678720
679721
---
@@ -748,6 +790,12 @@ Destroys the raw transaction bytes allocated for an FFIUnconfirmedTransaction #
748790
dash_spv_ffi_client_enable_mempool_tracking(client: *mut FFIDashSpvClient, strategy: FFIMempoolStrategy,) -> i32
749791
```
750792

793+
**Description:**
794+
Enable mempool tracking with a given strategy. # Safety - `client` must be a valid, non-null pointer.
795+
796+
**Safety:**
797+
- `client` must be a valid, non-null pointer.
798+
751799
**Module:** `client`
752800

753801
---
@@ -826,6 +874,12 @@ This function is unsafe because: - The caller must ensure the handle pointer is
826874
dash_spv_ffi_client_set_event_callbacks(client: *mut FFIDashSpvClient, callbacks: FFIEventCallbacks,) -> i32
827875
```
828876
877+
**Description:**
878+
Set event callbacks for the client. # Safety - `client` must be a valid, non-null pointer.
879+
880+
**Safety:**
881+
- `client` must be a valid, non-null pointer.
882+
829883
**Module:** `client`
830884
831885
---
@@ -931,6 +985,12 @@ Get all checkpoints between two heights (inclusive). Returns an `FFIArray` of `
931985
dash_spv_ffi_client_get_stats(client: *mut FFIDashSpvClient,) -> *mut FFISpvStats
932986
```
933987

988+
**Description:**
989+
Get current runtime statistics for the SPV client. # Safety - `client` must be a valid, non-null pointer.
990+
991+
**Safety:**
992+
- `client` must be a valid, non-null pointer.
993+
934994
**Module:** `client`
935995

936996
---
@@ -942,7 +1002,7 @@ dash_spv_ffi_client_get_wallet_manager(client: *mut FFIDashSpvClient,) -> *mut c
9421002
```
9431003
9441004
**Description:**
945-
Get the wallet manager from the SPV client Returns an opaque pointer to FFIWalletManager that contains a cloned Arc reference to the wallet manager. This allows direct interaction with the wallet manager without going through the client. # Safety The caller must ensure that: - The client pointer is valid - The returned pointer is freed using `wallet_manager_free` from key-wallet-ffi # Returns An opaque pointer (void*) to the wallet manager, or NULL if the client is not initialized. Swift should treat this as an OpaquePointer.
1005+
Get the wallet manager from the SPV client Returns an opaque pointer to FFIWalletManager that contains a cloned Arc reference to the wallet manager. This allows direct interaction with the wallet manager without going through the client. # Safety The caller must ensure that: - The client pointer is valid - The returned pointer is freed using `wallet_manager_free` from key-wallet-ffi # Returns An opaque pointer (void*) to the wallet manager, or NULL if the client is not initialized. Swift should treat this as an OpaquePointer. Get a handle to the wallet manager owned by this client. # Safety - `client` must be a valid, non-null pointer.
9461006
9471007
**Safety:**
9481008
The caller must ensure that: - The client pointer is valid - The returned pointer is freed using `wallet_manager_free` from key-wallet-ffi
@@ -957,6 +1017,12 @@ The caller must ensure that: - The client pointer is valid - The returned pointe
9571017
dash_spv_ffi_client_record_send(client: *mut FFIDashSpvClient, txid: *const c_char,) -> i32
9581018
```
9591019

1020+
**Description:**
1021+
Record that we attempted to send a transaction by its txid. # Safety - `client` and `txid` must be valid, non-null pointers.
1022+
1023+
**Safety:**
1024+
- `client` and `txid` must be valid, non-null pointers.
1025+
9601026
**Module:** `client`
9611027

9621028
---
@@ -967,6 +1033,12 @@ dash_spv_ffi_client_record_send(client: *mut FFIDashSpvClient, txid: *const c_ch
9671033
dash_spv_ffi_client_rescan_blockchain(client: *mut FFIDashSpvClient, _from_height: u32,) -> i32
9681034
```
9691035
1036+
**Description:**
1037+
Request a rescan of the blockchain from a given height (not yet implemented). # Safety - `client` must be a valid, non-null pointer.
1038+
1039+
**Safety:**
1040+
- `client` must be a valid, non-null pointer.
1041+
9701042
**Module:** `client`
9711043
9721044
---
@@ -987,6 +1059,12 @@ dash_spv_ffi_enable_test_mode() -> ()
9871059
dash_spv_ffi_init_logging(level: *const c_char) -> i32
9881060
```
9891061
1062+
**Description:**
1063+
Initialize logging for the SPV library. # Safety - `level` may be null or point to a valid, NUL-terminated C string. - If non-null, the pointer must remain valid for the duration of this call.
1064+
1065+
**Safety:**
1066+
- `level` may be null or point to a valid, NUL-terminated C string. - If non-null, the pointer must remain valid for the duration of this call.
1067+
9901068
**Module:** `utils`
9911069
9921070
---
@@ -997,6 +1075,12 @@ dash_spv_ffi_init_logging(level: *const c_char) -> i32
9971075
dash_spv_ffi_spv_stats_destroy(stats: *mut FFISpvStats) -> ()
9981076
```
9991077

1078+
**Description:**
1079+
Destroy an `FFISpvStats` object returned by this crate. # Safety - `stats` must be a pointer returned from this crate, or null.
1080+
1081+
**Safety:**
1082+
- `stats` must be a pointer returned from this crate, or null.
1083+
10001084
**Module:** `client`
10011085

10021086
---

0 commit comments

Comments
 (0)