-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9d2411
commit 4148ee8
Showing
9 changed files
with
199 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[[language]] | ||
name = "rust" | ||
config = { cargo = { features = [ "blocking", "wallet", "mint" ] } } | ||
config = { cargo = { features = [ "wallet", "mint" ] } } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
pub mod amount; | ||
pub mod bolt11_invoice; | ||
pub mod proofs_status; | ||
pub mod secret; | ||
|
||
pub use amount::JsAmount; | ||
pub use bolt11_invoice::JsBolt11Invoice; | ||
pub use proofs_status::JsProofsStatus; | ||
pub use secret::JsSecret; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,48 @@ | ||
use std::ops::Deref; | ||
|
||
use cashu::types::ProofsStatus; | ||
use wasm_bindgen::prelude::*; | ||
|
||
use crate::error::{into_err, Result}; | ||
|
||
#[wasm_bindgen(js_name = ProofsStatus)] | ||
pub struct JsProofsStatus { | ||
inner: ProofsStatus, | ||
} | ||
|
||
impl Deref for JsProofsStatus { | ||
type Target = ProofsStatus; | ||
fn deref(&self) -> &Self::Target { | ||
&self.inner | ||
} | ||
} | ||
|
||
impl From<ProofsStatus> for JsProofsStatus { | ||
fn from(inner: ProofsStatus) -> JsProofsStatus { | ||
JsProofsStatus { inner } | ||
} | ||
} | ||
|
||
#[wasm_bindgen(js_class = ProofsStatus)] | ||
impl JsProofsStatus { | ||
#[wasm_bindgen(constructor)] | ||
pub fn new(spent_proofs: JsValue, spendable_proofs: JsValue) -> Result<JsProofsStatus> { | ||
let spent = serde_wasm_bindgen::from_value(spent_proofs).map_err(into_err)?; | ||
let spendable = serde_wasm_bindgen::from_value(spendable_proofs).map_err(into_err)?; | ||
Ok(JsProofsStatus { | ||
inner: ProofsStatus { spent, spendable }, | ||
}) | ||
} | ||
|
||
/// Get Spendable Proofs | ||
#[wasm_bindgen(getter)] | ||
pub fn spendable(&self) -> Result<JsValue> { | ||
serde_wasm_bindgen::to_value(&self.inner.spendable).map_err(into_err) | ||
} | ||
|
||
/// Get Spent Proofs | ||
#[wasm_bindgen(getter)] | ||
pub fn spent_proofs(&self) -> Result<JsValue> { | ||
serde_wasm_bindgen::to_value(&self.inner.spent).map_err(into_err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
mod melted; | ||
mod proof_status; | ||
mod send_proofs; | ||
|
||
pub use melted::JsMelted; | ||
pub use send_proofs::JsSendProofs; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters