whisky_js/wasm/
transaction.rs1use crate::*;
2use whisky_csl::{calculate_tx_hash, sign_transaction};
3
4use wasm::WasmResult;
5
6#[wasm_bindgen]
7pub fn js_calculate_tx_hash(tx_hex: &str) -> WasmResult {
8 let result = calculate_tx_hash(tx_hex);
9 WasmResult::from_result(result)
10}
11
12#[wasm_bindgen]
13pub fn js_sign_transaction(tx_hex: String, signing_keys: JsVecString) -> WasmResult {
14 let result = sign_transaction(
15 &tx_hex,
16 signing_keys
17 .iter()
18 .map(|x| x.as_str())
19 .collect::<Vec<&str>>()
20 .as_slice(),
21 );
22 WasmResult::from_result(result)
23}