Remove dead code

This commit is contained in:
NicolasCantu 2025-03-12 10:47:38 +01:00
parent 4c558589d0
commit 99c548c755

View File

@ -345,110 +345,6 @@ pub fn unpair_device() -> ApiResult<()> {
Ok(())
}
#[derive(Debug, Tsify, Serialize, Deserialize)]
#[tsify(from_wasm_abi, into_wasm_abi)]
#[allow(non_camel_case_types)]
pub struct outputs_list(OutputList);
impl outputs_list {
fn as_inner(&self) -> &OutputList {
&self.0
}
}
// #[wasm_bindgen]
// pub fn login(previous_login_tx: String, fee_rate: u32) -> ApiResult<ApiReturn> {
// // We first create a transaction that spends both pairing tx outputs
// let previous_tx: Txid = deserialize(&Vec::from_hex(&previous_login_tx)?)?;
// let device = lock_local_device()?;
// if !device.is_linked() {
// return Err(ApiError::new("Device is not linked".to_owned()));
// }
// let member = device.to_member().unwrap();
// let nb_outputs = member.get_addresses().len();
// let other_addresses = device.get_other_addresses();
// // We get the pairing process out of cache
// let commitment_txid = device.get_process_commitment().unwrap();
// let commitment_outpoint = OutPoint::new(commitment_txid, 0);
// let process = lock_processes()?.get(&commitment_outpoint).unwrap().clone();
// let state = process.get_latest_state().unwrap().clone();
// let mut shared_secrets = Vec::new();
// for address in other_addresses {
// let shared_secret =
// process.get_shared_secret_for_address(&SilentPaymentAddress::try_from(address)?);
// if let Some(shared_secret) = shared_secret {
// shared_secrets.push(shared_secret);
// }
// }
// let mut decrypted_pcd = Map::new();
// state
// .encrypted_pcd
// .decrypt_fields(&state.keys, &mut decrypted_pcd)?;
// let pairing_tx = decrypted_pcd.get("pairing_tx").unwrap().as_str().unwrap();
// let wallet = device.get_wallet();
// let freezed_utxos = lock_freezed_utxos()?;
// let recipients: Vec<Recipient> = device
// .to_member()
// .unwrap()
// .get_addresses()
// .iter()
// .map(|a| Recipient {
// address: a.clone(),
// amount: DEFAULT_AMOUNT,
// nb_outputs: 1,
// })
// .collect();
// let mut mandatory_inputs = Vec::new();
// for i in 0u32..nb_outputs.try_into().unwrap() {
// mandatory_inputs.push(OutPoint::new(previous_tx, i));
// }
// let signed_psbt = create_transaction(
// mandatory_inputs,
// &freezed_utxos,
// wallet,
// recipients,
// None,
// Amount::from_sat(fee_rate.into()),
// None,
// )?;
// // We send it in a TxProposal prd
// let tx_proposal = Prd::new_tx_proposal(commitment_outpoint, member, signed_psbt);
// debug!("tx_proposal: {:?}", tx_proposal);
// // We encrypt the prd with the shared_secret for pairing process
// let prd_msg = tx_proposal.to_network_msg(wallet)?;
// debug!("prd_msg: {:?}", prd_msg);
// let mut ciphers = Vec::new();
// for shared_secret in shared_secrets {
// let cipher = encrypt_with_key(shared_secret.as_byte_array(), prd_msg.as_bytes())?;
// ciphers.push(cipher.to_lower_hex_string());
// }
// // We return the cipher
// Ok(ApiReturn {
// ciphers_to_send: ciphers,
// ..Default::default()
// })
// }
#[wasm_bindgen]
pub fn logout() -> ApiResult<()> {
unimplemented!();
}
#[wasm_bindgen]
pub fn dump_wallet() -> ApiResult<String> {
let device = lock_local_device()?;