diff --git a/Cargo.toml b/Cargo.toml index bb21f2772..322d0e9d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,7 +68,7 @@ futures = "0.3" tokio = { version = "1", default-features = false, features = [ "rt-multi-thread", "time", "sync" ] } esplora-client = { version = "0.6", default-features = false } libc = "0.2" -uniffi = { version = "0.26.0", features = ["build"], optional = true } +uniffi = { version = "0.25.3", features = ["build"], optional = true } [target.'cfg(vss)'.dependencies] vss-client = "0.2" @@ -95,7 +95,7 @@ electrsd = { version = "0.26.0", features = ["legacy"] } clightningrpc = { version = "0.3.0-beta.8", default-features = false } [build-dependencies] -uniffi = { version = "0.26.0", features = ["build"], optional = true } +uniffi = { version = "0.25.3", features = ["build"], optional = true } [profile.release] panic = "abort" diff --git a/bindings/ldk_node.udl b/bindings/ldk_node.udl index 30b2d4a1b..ec5d8f993 100644 --- a/bindings/ldk_node.udl +++ b/bindings/ldk_node.udl @@ -44,8 +44,8 @@ interface LDKNode { void stop(); Event? next_event(); Event wait_next_event(); - [Async] - Event next_event_async(); + // [Async] + // Event next_event_async(); void event_handled(); PublicKey node_id(); sequence? listening_addresses(); @@ -211,13 +211,16 @@ dictionary PaymentDetails { LSPFeeLimits? lsp_fee_limits; }; -[NonExhaustive] -enum Network { - "Bitcoin", - "Testnet", - "Signet", - "Regtest", -}; +// [NonExhaustive] +// enum Network { +// "Bitcoin", +// "Testnet", +// "Signet", +// "Regtest", +// }; + +[Custom] +typedef string Network; dictionary OutPoint { Txid txid; diff --git a/bindings/uniffi-bindgen/Cargo.toml b/bindings/uniffi-bindgen/Cargo.toml index b823f397d..951b59f78 100644 --- a/bindings/uniffi-bindgen/Cargo.toml +++ b/bindings/uniffi-bindgen/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -uniffi = { version = "0.26.0", features = ["cli"] } +uniffi = { version = "0.25.3", features = ["cli"] } diff --git a/src/uniffi_types.rs b/src/uniffi_types.rs index 7c6343b84..207b40ead 100644 --- a/src/uniffi_types.rs +++ b/src/uniffi_types.rs @@ -215,3 +215,14 @@ impl UniffiCustomTypeConverter for UntrustedString { obj.to_string() } } + +impl UniffiCustomTypeConverter for Network { + type Builtin = String; + fn into_custom(val: Self::Builtin) -> uniffi::Result { + Ok(Network::from_str(&val).map_err(|_| Error::InvalidNetwork)?) + } + + fn from_custom(obj: Self) -> Self::Builtin { + obj.to_string() + } +}