Skip to content

Commit 01bbfae

Browse files
authored
refactor(sdk): drop the key-wallet-ffi dependency (#5728)
1 parent ad0664a commit 01bbfae

48 files changed

Lines changed: 273 additions & 3839 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Cargo.lock‎

Lines changed: 0 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ dashcore = { git = "https://github.com/dashpay/rust-dashcore", rev = "7329126edf
7474
dash-network-seeds = { git = "https://github.com/dashpay/rust-dashcore", rev = "7329126edf27fb0356c444888ad1207bdfa2e39a" }
7575
dash-spv = { git = "https://github.com/dashpay/rust-dashcore", rev = "7329126edf27fb0356c444888ad1207bdfa2e39a" }
7676
key-wallet = { git = "https://github.com/dashpay/rust-dashcore", rev = "7329126edf27fb0356c444888ad1207bdfa2e39a" }
77-
key-wallet-ffi = { git = "https://github.com/dashpay/rust-dashcore", rev = "7329126edf27fb0356c444888ad1207bdfa2e39a" }
7877
key-wallet-manager = { git = "https://github.com/dashpay/rust-dashcore", rev = "7329126edf27fb0356c444888ad1207bdfa2e39a" }
7978
dash-network = { git = "https://github.com/dashpay/rust-dashcore", rev = "7329126edf27fb0356c444888ad1207bdfa2e39a" }
8079
dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore", rev = "7329126edf27fb0356c444888ad1207bdfa2e39a" }

‎book/src/contributing/coding-conventions.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ and the [WASM](../wasm/binding-patterns.md) chapters.
442442

443443
### FFI and mobile SDKs hold no business logic
444444

445-
The FFI crates (`rs-sdk-ffi`, `rs-platform-wallet-ffi`, `key-wallet-ffi`) and
445+
The FFI crates (`rs-sdk-ffi`, `rs-platform-wallet-ffi`) and
446446
the Swift and Kotlin SDKs do three things: persist Rust-emitted state, load it
447447
for views, and call a function that already exists in a Rust library. If the
448448
wrapper is deciding anything (an index, a derivation path, which key, how

‎packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/Network.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package org.dashfoundation.dashsdk
33
/**
44
* The Dash network the SDK is operating on.
55
*
6-
* Kotlin mirror of `dash-network`'s `FFINetwork` C-ABI enum — the single
6+
* Kotlin mirror of `rs-sdk-ffi`'s `FFINetwork` C-ABI enum — the single
77
* network type every Rust FFI surface takes/returns. Port of
88
* `SwiftDashSDK/DashNetwork.swift`; [ffiValue] ordinals must stay in sync
9-
* with `dash-network/src/ffi.rs`.
9+
* with `rs-sdk-ffi/src/types.rs`.
1010
*/
1111
enum class Network(val ffiValue: Int) {
1212
MAINNET(0),

‎packages/kotlin-sdk/sdk/src/test/kotlin/org/dashfoundation/dashsdk/NetworkTest.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import org.junit.Test
88
class NetworkTest {
99

1010
@Test
11-
fun ffiOrdinalsMatchDashNetworkFfiEnum() {
12-
// Must stay in sync with dash-network/src/ffi.rs.
11+
fun ffiOrdinalsMatchSdkFfiEnum() {
12+
// Must stay in sync with rs-sdk-ffi/src/types.rs.
1313
assertEquals(0, Network.MAINNET.ffiValue)
1414
assertEquals(1, Network.TESTNET.ffiValue)
1515
assertEquals(2, Network.DEVNET.ffiValue)

‎packages/rs-platform-wallet-ffi/Cargo.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ tokio-metrics = { workspace = true, optional = true }
3232
# Core dependencies (for Network type)
3333
dashcore = { workspace = true }
3434
key-wallet = { workspace = true, features = ["bincode"] }
35-
dash-network = { workspace = true, features = ["ffi"] }
3635

3736
# For the glue impl of platform-wallet's async `DrainCryptoProvider` trait over
3837
# the resolver-backed signer (deferred-crypto drain FFI).

‎packages/rs-platform-wallet-ffi/src/mnemonic_words.rs‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ use platform_wallet::parse_mnemonic_any_language;
2828
///
2929
/// Discriminants match `key_wallet::Language`'s declaration order (and the
3030
/// Swift `MnemonicLanguage` raw values) so the three enums stay numerically
31-
/// aligned. Deliberately a distinct name from key-wallet-ffi's `FFILanguage`
32-
/// (same 0–9 values): both headers are exported by the single `DashSDKFFI`
33-
/// umbrella module, so reusing the name would be a C enumerator redefinition.
31+
/// aligned.
3432
#[repr(C)]
3533
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
3634
pub enum FFIMnemonicLanguage {

‎packages/rs-platform-wallet-ffi/src/types.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use std::os::raw::c_char;
55
// `FFINetwork` is the `#[repr(C)]` mirror cbindgen emits for callers.
66
// Every FFI entry point in this crate takes / returns `FFINetwork`;
77
// internal Rust code converts via `Network::from(ffi)` / `ffi.into()`.
8-
pub use dash_network::ffi::FFINetwork;
9-
pub use dash_network::Network;
8+
pub use rs_sdk_ffi::{FFINetwork, Network};
109

1110
/// Block time structure
1211
#[repr(C)]

‎packages/rs-sdk-ffi/Cargo.toml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ key-wallet = { workspace = true }
4444
# FFI. Single source of truth — reused, not re-implemented.
4545
platform-encryption = { path = "../rs-platform-encryption" }
4646

47-
# Single source of truth for the Network enum and its `#[repr(C)]`
48-
# FFI variant, both used directly across this crate's FFI surface.
49-
dash-network = { workspace = true, features = ["ffi"] }
47+
# Single source of truth for the Network enum. `FFINetwork` in
48+
# `src/types.rs` is its `#[repr(C)]` mirror.
49+
dash-network = { workspace = true }
5050

5151
# FFI and serialization
5252
serde = { version = "1.0", features = ["derive"] }

‎packages/rs-sdk-ffi/README.md‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,6 @@ result = lib.dash_sdk_create(byref(config))
204204
- `dash_spv_ffi_client_broadcast_transaction()` - Broadcast transaction
205205
- `dash_spv_ffi_client_get_transaction()` - Get transaction details
206206

207-
#### HD Wallet Functions
208-
- `key_wallet_ffi_mnemonic_generate()` - Generate HD wallet mnemonic
209-
- `key_wallet_ffi_derive_address()` - Derive addresses from HD wallet
210-
- `key_wallet_ffi_sign_transaction()` - Sign transactions with HD keys
211-
212207
## Architecture
213208

214209
The FFI layer follows these principles:

0 commit comments

Comments
 (0)