-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exposed transaction signing to Wasm, bugfix
- Loading branch information
Showing
14 changed files
with
60 additions
and
30 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ mod parameters; | |
mod plugin; | ||
mod private; | ||
mod public; | ||
mod sign; | ||
mod tx; | ||
|
||
pub use parameters::*; | ||
|
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use super::*; | ||
|
||
use iop_keyvault::secp256k1::SecpPrivateKey; | ||
use iop_morpheus_core::hydra::sign::HydraSigner; | ||
|
||
#[wasm_bindgen(js_name = HydraSigner)] | ||
pub struct JsHydraSigner { | ||
inner: SecpPrivateKey, | ||
} | ||
|
||
#[wasm_bindgen(js_class = HydraSigner)] | ||
impl JsHydraSigner { | ||
#[wasm_bindgen(constructor)] | ||
pub fn new(inner: JsSecpPrivateKey) -> JsHydraSigner { | ||
inner.inner().to_owned().into() | ||
} | ||
|
||
#[wasm_bindgen(js_name = signHydraTransaction)] | ||
pub fn sign_hydra_transaction(&self, transaction: &JsValue) -> Result<JsValue, JsValue> { | ||
let mut tx = transaction.into_serde().map_err_to_js()?; | ||
self.inner.sign_hydra_transaction(&mut tx).map_err_to_js()?; | ||
JsValue::from_serde(&tx).map_err_to_js() | ||
} | ||
} | ||
|
||
impl From<SecpPrivateKey> for JsHydraSigner { | ||
fn from(inner: SecpPrivateKey) -> Self { | ||
Self { inner } | ||
} | ||
} | ||
|
||
impl Wraps<SecpPrivateKey> for JsHydraSigner { | ||
fn inner(&self) -> &SecpPrivateKey { | ||
&self.inner | ||
} | ||
} |
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
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,5 +1,5 @@ | ||
pub mod crypto; | ||
pub mod serializer; | ||
pub mod sign; | ||
pub mod transaction; | ||
pub mod txtype; | ||
|
||
|
File renamed without changes.
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