Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method for signing multi-sig input #751

Merged
merged 1 commit into from
Jun 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions bindings/ergo-lib-wasm/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,35 @@ impl Wallet {
.map_err(to_js)
.map(Input::from)
}

/// Sign a given multi-signature tx input
#[wasm_bindgen]
pub fn sign_tx_input_multi(
&self,
input_idx: usize,
state_context: &ErgoStateContext,
tx: &UnsignedTransaction,
boxes_to_spend: &ErgoBoxes,
data_boxes: &ErgoBoxes,
tx_hints: &TransactionHintsBag,
) -> Result<Input, JsValue> {
let boxes_to_spend = boxes_to_spend.clone().into();
let data_boxes = data_boxes.clone().into();
let tx_context = ergo_lib::wallet::signing::TransactionContext::new(
tx.0.clone(),
boxes_to_spend,
data_boxes,
)
.map_err(to_js)?;
let state_context_inner = state_context.clone().into();
self.0
.sign_tx_input(
input_idx,
tx_context,
&state_context_inner,
Some(&tx_hints.0),
)
.map_err(to_js)
.map(Input::from)
}
}
Loading