From 670c62973869a3d336bd549af7576976c72f13b4 Mon Sep 17 00:00:00 2001 From: nick-zkp <88881925+nick-zkp@users.noreply.github.com> Date: Mon, 11 Dec 2023 18:00:42 +0800 Subject: [PATCH] add sign_change_pubkey_with_onchain_auth_data in wasm(fix #125) (#126) * add sign_change_pubkey_with_onchain_auth_data in wasm(fix #125) --- bindings/wasm/src/signer.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bindings/wasm/src/signer.rs b/bindings/wasm/src/signer.rs index f46abb45..ca95dc30 100644 --- a/bindings/wasm/src/signer.rs +++ b/bindings/wasm/src/signer.rs @@ -60,6 +60,16 @@ impl Signer { self.inner.pubkey_hash().as_hex() } + #[wasm_bindgen(js_name=signChangePubkeyWithOnchain)] + pub fn sign_change_pubkey_with_onchain(&self, tx: ChangePubKey) -> Result { + let inner_tx = tx.json_value()?; + let change_pubkey: TxChangePubKey = serde_wasm_bindgen::from_value(inner_tx)?; + let signature = self + .inner + .sign_change_pubkey_with_onchain_auth_data(change_pubkey)?; + Ok(serde_wasm_bindgen::to_value(&signature)?) + } + #[wasm_bindgen(js_name=signChangePubkeyWithEthEcdsaAuth)] pub fn sign_change_pubkey_with_eth_ecdsa_auth( &self,