Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion dash-spv-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ log = "0.4"
hex = "0.4"
env_logger = "0.10"
tracing = "0.1"
key-wallet-manager = { path = "../key-wallet-manager" }
# Use key-wallet-ffi for all wallet-related FFI types
key-wallet-ffi = { path = "../key-wallet-ffi" }
# Still need these for SPV client internals (not for FFI types)
key-wallet = { path = "../key-wallet" }
key-wallet-manager = { path = "../key-wallet-manager" }
rand = "0.8"
Comment on lines +26 to 31
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

❓ Verification inconclusive

Dependency switch is correct; also re-export the types in this crate

Using key-wallet-ffi for FFI types is right. Please also re-export FFIBalance/FFIUTXO from dash-spv-ffi so cbindgen emits opaque declarations in dash_spv_ffi.h.

Proposed addition in dash-spv-ffi/src/lib.rs (new file change):

// Ensure wallet FFI types are visible to this crate's header
pub use key_wallet_ffi::{FFIBalance, FFIUTXO};

Then regenerate headers and sync into Swift SDK (Sources/DashSPVFFI/include/dash_spv_ffi.h).


🏁 Script executed:

#!/bin/bash
# After re-export, verify header now includes typedef struct FFIBalance/FFIUTXO
rg -n '^typedef\s+struct\s+FFI(Balance|UTXO)\b' dash-spv-ffi/include/dash_spv_ffi.h

Length of output: 85


🏁 Script executed:

#!/bin/bash
# Verify that lib.rs re-exports FFIBalance and FFIUTXO from key-wallet-ffi
rg -nP '^\s*pub\s+use\s+key_wallet_ffi::\{\s*FFIBalance\s*,\s*FFIUTXO\s*\}' dash-spv-ffi/src/lib.rs

Length of output: 101


Add missing FFI type re-exports for cbindgen
In dash-spv-ffi/src/lib.rs, add:

pub use key_wallet_ffi::{FFIBalance, FFIUTXO};

Then regenerate the C header (cbindgen) and sync it into the Swift SDK (e.g. via ./sync-headers.sh).

rg -n '^typedef\s\+struct\s\+FFI\(Balance\|UTXO\)\b' dash-spv-ffi/include/dash_spv_ffi.h
🤖 Prompt for AI Agents
In dash-spv-ffi/Cargo.toml around lines 26-31, the review requests adding
missing FFI type re-exports: open dash-spv-ffi/src/lib.rs and add a public
re-export line for the FFI types (pub use key_wallet_ffi::{FFIBalance,
FFIUTXO};), then regenerate the C header with cbindgen and sync it into the
Swift SDK (e.g. run ./sync-headers.sh). After that run the provided verification
command (rg -n '^typedef\s\+struct\s\+FFI\(Balance\|UTXO\)\b'
dash-spv-ffi/include/dash_spv_ffi.h) to confirm the typedefs are present.


[dev-dependencies]
Expand Down
9 changes: 0 additions & 9 deletions dash-spv-ffi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,10 @@ dash_spv_ffi_config_destroy(config);

### Wallet Operations

- `dash_spv_ffi_client_add_watch_item(client, item)` - Add address/script to watch
- `dash_spv_ffi_client_remove_watch_item(client, item)` - Remove watch item
- `dash_spv_ffi_client_get_address_balance(client, address)` - Get address balance
- `dash_spv_ffi_client_get_utxos(client)` - Get all UTXOs
- `dash_spv_ffi_client_get_utxos_for_address(client, address)` - Get UTXOs for address

### Watch Items

- `dash_spv_ffi_watch_item_address(address)` - Create address watch item
- `dash_spv_ffi_watch_item_script(script_hex)` - Create script watch item
- `dash_spv_ffi_watch_item_outpoint(txid, vout)` - Create outpoint watch item
- `dash_spv_ffi_watch_item_destroy(item)` - Free watch item memory

### Error Handling

- `dash_spv_ffi_get_last_error()` - Get last error message
Expand Down
Loading
Loading