Skip to content

Commit 8d93d2f

Browse files
author
Damien LACHAUME / PALO-IT
committed
Enable rust-analyzer in client_wasm
1 parent 4967ff0 commit 8d93d2f

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

mithril-client-wasm/src/client_wasm.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![cfg(target_family = "wasm")]
21
use async_trait::async_trait;
32
use mithril_client::{
43
feedback::{FeedbackReceiver, MithrilEvent},
@@ -10,6 +9,7 @@ use wasm_bindgen::prelude::*;
109

1110
type WasmResult = Result<JsValue, JsValue>;
1211

12+
#[wasm_bindgen]
1313
struct JSBroadcastChannelFeedbackReceiver {
1414
channel: String,
1515
}
@@ -50,12 +50,12 @@ impl From<MithrilEvent> for MithrilEventWasm {
5050
}
5151
}
5252

53-
#[cfg_attr(target_family = "wasm", wasm_bindgen(js_name = MithrilClient))]
53+
#[wasm_bindgen]
5454
pub struct MithrilClient {
5555
client: Client,
5656
}
5757

58-
#[wasm_bindgen(js_class = MithrilClient)]
58+
#[wasm_bindgen]
5959
impl MithrilClient {
6060
/// Constructor for wasm client
6161
#[wasm_bindgen(constructor)]
@@ -70,7 +70,6 @@ impl MithrilClient {
7070
}
7171

7272
/// Call the client to get a snapshot from a digest
73-
// #[wasm_bindgen(js_name = get_snapshot)]
7473
pub async fn get_snapshot(&self, digest: &str) -> WasmResult {
7574
let result = self
7675
.client
@@ -83,7 +82,6 @@ impl MithrilClient {
8382
}
8483

8584
/// Call the client to get the list of available snapshots
86-
// #[wasm_bindgen(js_name = list_snapshots)]
8785
pub async fn list_snapshots(&self) -> WasmResult {
8886
let result = self
8987
.client
@@ -96,7 +94,6 @@ impl MithrilClient {
9694
}
9795

9896
/// Call the client to get a mithril stake distribution from a hash
99-
// #[wasm_bindgen(js_name = get_mithril_stake_distribution)]
10097
pub async fn get_mithril_stake_distribution(&self, hash: &str) -> WasmResult {
10198
let result = self
10299
.client
@@ -109,7 +106,6 @@ impl MithrilClient {
109106
}
110107

111108
/// Call the client for the list of available mithril stake distributions
112-
// #[wasm_bindgen(js_name = list_mithril_stake_distributions)]
113109
pub async fn list_mithril_stake_distributions(&self) -> WasmResult {
114110
let result = self
115111
.client
@@ -122,7 +118,6 @@ impl MithrilClient {
122118
}
123119

124120
/// Call the client to compute a mithril stake distribution message
125-
// #[wasm_bindgen(js_name = compute_mithril_stake_distribution_message)]
126121
pub async fn compute_mithril_stake_distribution_message(
127122
&self,
128123
stake_distribution: JsValue,
@@ -137,7 +132,6 @@ impl MithrilClient {
137132
}
138133

139134
/// Call the client to verify a mithril stake distribution message
140-
// #[wasm_bindgen(js_name = verify_message_match_certificate)]
141135
pub async fn verify_message_match_certificate(
142136
&self,
143137
message: JsValue,
@@ -151,7 +145,6 @@ impl MithrilClient {
151145
}
152146

153147
/// Call the client to get a mithril certificate from a certificate hash
154-
// #[wasm_bindgen(js_name = get_mithril_certificate)]
155148
pub async fn get_mithril_certificate(&self, hash: &str) -> WasmResult {
156149
let result = self
157150
.client
@@ -164,7 +157,6 @@ impl MithrilClient {
164157
}
165158

166159
/// Call the client for the list of available mithril certificates
167-
// #[wasm_bindgen(js_name = list_mithril_certificates)]
168160
pub async fn list_mithril_certificates(&self) -> WasmResult {
169161
let result = self
170162
.client
@@ -177,7 +169,6 @@ impl MithrilClient {
177169
}
178170

179171
/// Call the client to verify the certificate chain from a certificate hash
180-
// #[wasm_bindgen(js_name = verify_certificate_chain)]
181172
pub async fn verify_certificate_chain(&self, hash: &str) -> WasmResult {
182173
let result = self
183174
.client
@@ -203,7 +194,7 @@ mod tests {
203194
"5b33322c3235332c3138362c3230312c3137372c31312c3131372c3133352c3138372c3136372c3138312c3138382c32322c35392c3230362c3130352c3233312c3135302c3231352c33302c37382c3231322c37362c31362c3235322c3138302c37322c3133342c3133372c3234372c3136312c36385d",
204195
).await;
205196

206-
let list = wasm_client
197+
wasm_client
207198
.list_mithril_stake_distributions()
208199
.await
209200
.expect("should not fail");

mithril-client-wasm/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![cfg(target_family = "wasm")]
21
mod client_wasm;
32

43
pub use client_wasm::MithrilClient;

0 commit comments

Comments
 (0)