diff --git a/Cargo.lock b/Cargo.lock index b0d051e..b07c759 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1674,7 +1674,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "waku-bindings" -version = "0.1.0" +version = "0.1.1" dependencies = [ "aes-gcm", "base64 0.21.0", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "waku-sys" -version = "0.1.0-rc.3" +version = "0.1.0" dependencies = [ "bindgen", ] diff --git a/examples/Cargo.lock b/examples/Cargo.lock index babfde8..7b78dab 100644 --- a/examples/Cargo.lock +++ b/examples/Cargo.lock @@ -1497,7 +1497,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "waku-bindings" -version = "0.1.0" +version = "0.1.1" dependencies = [ "aes-gcm", "base64 0.21.0", @@ -1517,7 +1517,7 @@ dependencies = [ [[package]] name = "waku-sys" -version = "0.1.0-rc.3" +version = "0.1.0" dependencies = [ "bindgen", ] diff --git a/waku-bindings/Cargo.toml b/waku-bindings/Cargo.toml index 3062e08..92d2160 100644 --- a/waku-bindings/Cargo.toml +++ b/waku-bindings/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "waku-bindings" -version = "0.1.0" +version = "0.1.1" edition = "2021" authors = [ "Daniel Sanchez Quiros " @@ -26,7 +26,7 @@ serde_json = "1.0" sscanf = "0.4" smart-default = "0.6" url = "2.3" -waku-sys = { version = "0.1.0-rc.3", path = "../waku-sys" } +waku-sys = { version = "0.1.0", path = "../waku-sys" } [dev-dependencies] futures = "0.3.25" diff --git a/waku-bindings/src/lib.rs b/waku-bindings/src/lib.rs index 5b1e141..c62a4da 100644 --- a/waku-bindings/src/lib.rs +++ b/waku-bindings/src/lib.rs @@ -9,7 +9,7 @@ mod utils; pub use node::{ waku_create_content_topic, waku_create_pubsub_topic, waku_dafault_pubsub_topic, - waku_dns_discovery, waku_new, Aes256Gcm, DnsInfo, GossipSubParams, Initialized, Key, Multiaddr, + waku_dns_discovery, waku_discv5_update_bootnodes, waku_new, Aes256Gcm, DnsInfo, GossipSubParams, Initialized, Key, Multiaddr, Protocol, PublicKey, Running, SecretKey, WakuLogLevel, WakuNodeConfig, WakuNodeHandle, WakuPeerData, WakuPeers, }; diff --git a/waku-bindings/src/node/discovery.rs b/waku-bindings/src/node/discovery.rs index 9a1827b..141cec3 100644 --- a/waku-bindings/src/node/discovery.rs +++ b/waku-bindings/src/node/discovery.rs @@ -59,6 +59,26 @@ pub fn waku_dns_discovery( decode_and_free_response(result_ptr) } +/// Update the bootnodes used by DiscoveryV5 by passing a list of ENRs +pub fn waku_discv5_update_bootnodes( + bootnodes: Vec +) -> Result<()> { + let bootnodes_ptr = CString::new( + serde_json::to_string(&bootnodes) + .expect("Serialization from properly built bootnode array should never fail"), + ) + .expect("CString should build properly from the string vector") + .into_raw(); + + let result_ptr = unsafe { + let res = waku_sys::waku_discv5_update_bootnodes(bootnodes_ptr); + drop(CString::from_raw(bootnodes_ptr)); + res + }; + + decode_and_free_response::(result_ptr).map(|_| ()) +} + #[cfg(test)] mod test { use url::Url; diff --git a/waku-bindings/src/node/mod.rs b/waku-bindings/src/node/mod.rs index a2ac5d5..8a91a79 100644 --- a/waku-bindings/src/node/mod.rs +++ b/waku-bindings/src/node/mod.rs @@ -25,7 +25,7 @@ use crate::general::{ }; pub use config::{GossipSubParams, WakuLogLevel, WakuNodeConfig}; -pub use discovery::{waku_dns_discovery, DnsInfo}; +pub use discovery::{waku_dns_discovery, waku_discv5_update_bootnodes, DnsInfo}; pub use peers::{Protocol, WakuPeerData, WakuPeers}; pub use relay::{waku_create_content_topic, waku_create_pubsub_topic, waku_dafault_pubsub_topic}; pub use store::{waku_local_store_query, waku_store_query}; @@ -312,6 +312,15 @@ impl WakuNodeHandle { ) -> Result<()> { filter::waku_filter_unsubscribe(filter_subscription, timeout) } + + + /// Update the bootnodes used by DiscoveryV5 by passing a list of ENRs + pub fn discv5_update_bootnodes( + bootnodes: Vec + ) -> Result<()> { + discovery::waku_discv5_update_bootnodes(bootnodes) + } + } /// Spawn a new Waku node with the given configuration (default configuration if `None` provided) diff --git a/waku-sys/Cargo.toml b/waku-sys/Cargo.toml index acc8042..1284636 100644 --- a/waku-sys/Cargo.toml +++ b/waku-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "waku-sys" -version = "0.1.0-rc.3" +version = "0.1.0" edition = "2021" authors = [ "Daniel Sanchez Quiros " diff --git a/waku-sys/vendor b/waku-sys/vendor index d9a12bf..f6fe353 160000 --- a/waku-sys/vendor +++ b/waku-sys/vendor @@ -1 +1 @@ -Subproject commit d9a12bf079a8bbb59ab1df591062b9bb91d3804d +Subproject commit f6fe353e2ee31bd5514811327cb1ca2478e2e4a9