From 5fb65566947ff8f5e1314671733c9254cda97e29 Mon Sep 17 00:00:00 2001 From: "Justin R. Evans" Date: Tue, 19 Nov 2024 06:01:10 -0500 Subject: [PATCH] fix: clean up --- packages/shared/lib/src/types/masp.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/shared/lib/src/types/masp.rs b/packages/shared/lib/src/types/masp.rs index 3274b03050..2be675e030 100644 --- a/packages/shared/lib/src/types/masp.rs +++ b/packages/shared/lib/src/types/masp.rs @@ -1,8 +1,11 @@ //! PaymentAddress - Provide wasm_bindgen bindings for shielded addresses //! See @namada/crypto for zip32 HD wallet functionality. use namada_sdk::borsh::BorshDeserialize; -use namada_sdk::{ExtendedViewingKey as NamadaExtendedViewingKey, ExtendedSpendingKey as NamadaExtendedSpendingKey, PaymentAddress as NamadaPaymentAddress}; use namada_sdk::masp_primitives::{sapling, zip32}; +use namada_sdk::{ + ExtendedSpendingKey as NamadaExtendedSpendingKey, + ExtendedViewingKey as NamadaExtendedViewingKey, PaymentAddress as NamadaPaymentAddress, +}; use thiserror::Error; use wasm_bindgen::prelude::*; @@ -23,13 +26,13 @@ pub struct ExtendedViewingKey(pub(crate) NamadaExtendedViewingKey); impl ExtendedViewingKey { /// Instantiate ExtendedViewingKey from serialized vector #[wasm_bindgen(constructor)] - pub fn new(key: &[u8]) -> Result { - let xfvk: zip32::ExtendedFullViewingKey = BorshDeserialize::try_from_slice(key) + pub fn new(xfvk_bytes: &[u8]) -> Result { + let xfvk: zip32::ExtendedFullViewingKey = BorshDeserialize::try_from_slice(xfvk_bytes) .map_err(|err| format!("{}: {:?}", MaspError::BorshDeserialize, err))?; - let vk = NamadaExtendedViewingKey::from(xfvk); + let xvk = NamadaExtendedViewingKey::from(xfvk); - Ok(ExtendedViewingKey(vk)) + Ok(ExtendedViewingKey(xvk)) } /// Return ExtendedViewingKey as Bech32-encoded String @@ -47,8 +50,8 @@ pub struct ExtendedSpendingKey(pub(crate) NamadaExtendedSpendingKey); impl ExtendedSpendingKey { /// Instantiate ExtendedSpendingKey from serialized vector #[wasm_bindgen(constructor)] - pub fn new(key: &[u8]) -> Result { - let xsk: zip32::ExtendedSpendingKey = BorshDeserialize::try_from_slice(key) + pub fn new(xsk_bytes: &[u8]) -> Result { + let xsk: zip32::ExtendedSpendingKey = BorshDeserialize::try_from_slice(xsk_bytes) .map_err(|err| format!("{}: {:?}", MaspError::BorshDeserialize, err))?; let xsk = NamadaExtendedSpendingKey::from(xsk);