-
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.
Add FFI calls required for the Dart tutorials
- Loading branch information
1 parent
3d509a0
commit 64e0659
Showing
5 changed files
with
56 additions
and
3 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
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,16 @@ | ||
use super::*; | ||
|
||
#[no_mangle] | ||
pub extern "C" fn SecpPrivateKey_sign_hydra_tx( | ||
sk: *mut SecpPrivateKey, unsigned_tx: *const raw::c_char, | ||
) -> CPtrResult<raw::c_char> { | ||
let sk = unsafe { convert::borrow_in(sk) }; | ||
let fun = || { | ||
let tx_str = unsafe { convert::str_in(unsigned_tx)? }; | ||
let mut tx_data: TransactionData = serde_json::from_str(tx_str)?; | ||
sk.sign_hydra_transaction(&mut tx_data)?; | ||
let signed_tx_str = serde_json::to_string(&tx_data)?; | ||
Ok(convert::string_out(signed_tx_str)) | ||
}; | ||
cresult(fun()) | ||
} |
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