Skip to content

Commit 1974953

Browse files
committed
Merge branch 'version'
2 parents 8ae6257 + bf3885f commit 1974953

File tree

6 files changed

+16
-4
lines changed

6 files changed

+16
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "bitbox-api"
33
authors = ["Marko Bencun <[email protected]>"]
4-
version = "0.3.1"
4+
version = "0.4.0"
55
homepage = "https://bitbox.swiss/"
66
repository = "https://github.com/BitBoxSwiss/bitbox-api-rs/"
77
readme = "README-rust.md"

NPM_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.0
1+
0.5.0

sandbox/src/App.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ function App() {
5858
<div className="contentContainer">
5959
<h2 style={{textAlign: 'left'}}>BitBox02 sandbox</h2>
6060
<h4 style={{textAlign: 'left'}}>
61-
Connected product: {bb02.product()}
61+
<p>Connected product: {bb02.product()}</p>
62+
<p>Connected firmware version: {bb02.version()}</p>
6263
&nbsp;
6364
<button onClick={() => bb02.close()}>Close connection</button>
6465
</h4>

src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,11 @@ impl<R: Runtime> PairedBitBox<R> {
331331
self.communication.info.product
332332
}
333333

334+
/// Returns the firmware version.
335+
pub fn version(&self) -> &semver::Version {
336+
&self.communication.info.version
337+
}
338+
334339
/// Returns the hex-encoded 4-byte root fingerprint.
335340
pub async fn root_fingerprint(&self) -> Result<String, Error> {
336341
match self

src/wasm/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,12 @@ impl PairedBitBox {
209209
}
210210
}
211211

212+
/// Returns the firmware version, e.g. "9.18.0".
213+
#[wasm_bindgen(js_name = version)]
214+
pub fn version(&self) -> String {
215+
self.device.version().to_string()
216+
}
217+
212218
/// Returns the hex-encoded 4-byte root fingerprint.
213219
#[wasm_bindgen(js_name = rootFingerprint)]
214220
pub async fn root_fingerprint(&self) -> Result<String, JavascriptError> {

0 commit comments

Comments
 (0)