Skip to content

Commit

Permalink
Expose build_with_vss_* methods in bindings.
Browse files Browse the repository at this point in the history
  • Loading branch information
G8XSU committed Oct 15, 2024
1 parent 5eee52e commit 66bdf17
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ chrono = { version = "0.4", default-features = false, features = ["clock"] }
tokio = { version = "1.37", default-features = false, features = [ "rt-multi-thread", "time", "sync", "macros" ] }
esplora-client = { version = "0.9", default-features = false }
libc = "0.2"
uniffi = { version = "0.26.0", features = ["build"], optional = true }
uniffi = { version = "0.27.3", features = ["build"], optional = true }

[target.'cfg(vss)'.dependencies]
vss-client = "0.3"
Expand All @@ -97,7 +97,7 @@ electrsd = { version = "0.29.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.27.3", features = ["build"], optional = true }

[profile.release]
panic = "abort"
Expand Down
20 changes: 20 additions & 0 deletions bindings/ldk_node.udl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ interface Builder {
Node build();
[Throws=BuildError]
Node build_with_fs_store();
[Throws=BuildError]
Node build_with_vss_store(string vss_url, string store_id, string lnurl_auth_server_url, record<string, string> fixed_headers);
[Throws=BuildError]
Node build_with_vss_store_with_fixed_headers(string vss_url, string store_id, record<string, string> fixed_headers);
[Throws=BuildError]
Node build_with_vss_store_and_header_provider(string vss_url, string store_id, VssHeaderProvider header_provider);
};

interface Node {
Expand Down Expand Up @@ -250,6 +256,20 @@ enum BuildError {
"LoggerSetupFailed",
};

[Trait]
interface VssHeaderProvider {
[Async, Throws=VssHeaderProviderError]
record<string, string> get_headers([ByRef]sequence<u8> request);
};

[Error]
enum VssHeaderProviderError {
"InvalidData",
"RequestError",
"AuthorizationError",
"InternalError",
};

[Enum]
interface Event {
PaymentSuccessful(PaymentId? payment_id, PaymentHash payment_hash, u64? fee_paid_msat);
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ pub use io::utils::generate_entropy_mnemonic;

#[cfg(feature = "uniffi")]
use uniffi_types::*;
#[cfg(all(vss, feature = "uniffi"))]
use vss_client::headers::VssHeaderProvider;
#[cfg(all(vss, feature = "uniffi"))]
use vss_client::headers::VssHeaderProviderError;

#[cfg(feature = "uniffi")]
pub use builder::ArcedNodeBuilder as Builder;
Expand Down

0 comments on commit 66bdf17

Please sign in to comment.