Skip to content

Commit

Permalink
feat/wasm: Wasm export (#706)
Browse files Browse the repository at this point in the history
* Added new rumqttc version to prevent removed feature warning

* Added asm to workspace

* Updated name to use in rust, added pub mod

* revert name

* Getter for wasm client

* Added clone

* renamed to into_inner

* reverted cargo changes

* Added wasm back as its own workspace

* Exposed most modules for wasm
  • Loading branch information
Brord van Wierst authored Oct 5, 2021
1 parent a9351b4 commit ee19ec4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static void nodeInfo() {
public static void generateSeed() {
try {
SecretKey secret_key = SecretKey.generate();
System.out.println(RustHex.encode(secret_key.toLeBytes()));
System.out.println(RustHex.encode(secret_key.to_bytes()));
} catch (ClientException e) {
System.out.println("Error: " + e.getMessage());
}
Expand Down
6 changes: 6 additions & 0 deletions bindings/wasm/native/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ pub struct Client {
pub(crate) client: Rc<RustClient>,
}

impl Client {
pub fn into_inner(&self) -> RustClient {
RustClient::clone(&self.client)
}
}

#[wasm_bindgen]
impl Client {
/// Send a message to the Tangle.
Expand Down
16 changes: 8 additions & 8 deletions bindings/wasm/native/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ use wasm_bindgen::prelude::*;

#[macro_use]
mod macros;
mod address_getter;
mod balance_getter;
mod client;
mod client_builder;
pub mod address_getter;
pub mod balance_getter;
pub mod client;
pub mod client_builder;
mod error;
mod get_address;
mod message_builder;
mod message_getter;
mod unspent_address_getter;
pub mod get_address;
pub mod message_builder;
pub mod message_getter;
pub mod unspent_address_getter;

pub use client_builder::ClientBuilder;

Expand Down

0 comments on commit ee19ec4

Please sign in to comment.