1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use wasm_bindgen::prelude::{wasm_bindgen, JsError};

use crate::{
    assets::{Coin, Value},
    transaction::TransactionBody,
};

#[wasm_bindgen]
pub fn get_implicit_input(
    txbody: &TransactionBody,
    pool_deposit: Coin, // // protocol parameter
    key_deposit: Coin,  // protocol parameter
) -> Result<Value, JsError> {
    cml_chain::deposit::get_implicit_input(txbody.as_ref(), pool_deposit, key_deposit)
        .map(Into::into)
        .map_err(Into::into)
}

#[wasm_bindgen]
pub fn get_deposit(
    txbody: &TransactionBody,
    pool_deposit: Coin, // // protocol parameter
    key_deposit: Coin,  // protocol parameter
) -> Result<Coin, JsError> {
    cml_chain::deposit::get_deposit(txbody.as_ref(), pool_deposit, key_deposit).map_err(Into::into)
}