From 32b535d67f4a7ea4ef9b500dde82ed7270a71f4c Mon Sep 17 00:00:00 2001 From: pierre Date: Tue, 22 Nov 2022 17:38:47 +0100 Subject: [PATCH] fix(wallet-buy-nym): signature output --- .../src/operations/signatures/sign.rs | 10 +++++----- .../src/components/Buy/SignMessageModal.tsx | 18 ++++++++++-------- nym-wallet/src/components/Buy/Tutorial.tsx | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/nym-wallet/src-tauri/src/operations/signatures/sign.rs b/nym-wallet/src-tauri/src/operations/signatures/sign.rs index 4ebca7aa56..abb132c1c8 100644 --- a/nym-wallet/src-tauri/src/operations/signatures/sign.rs +++ b/nym-wallet/src-tauri/src/operations/signatures/sign.rs @@ -13,7 +13,7 @@ use serde_json::json; pub struct SignatureOutputJson { pub account_id: String, pub public_key: PublicKey, - pub signature: String, + pub signature_as_hex: String, } #[tauri::command] @@ -32,14 +32,14 @@ pub async fn sign( log::info!("<<< Signing message"); let signature = wallet.sign_raw_with_account(account, message.as_bytes())?; - let signature_as_hex_string = signature.to_string(); let output = SignatureOutputJson { account_id: account.address().to_string(), public_key: account.public_key(), - signature: signature_as_hex_string.to_string(), + signature_as_hex: signature.to_string(), }; - log::info!(">>> Signing data {}", json!(output),); - Ok(signature_as_hex_string) + let output_json = json!(output).to_string(); + log::info!(">>> Signing data {}", output_json); + Ok(output_json) } async fn get_pubkey_from_account_address( diff --git a/nym-wallet/src/components/Buy/SignMessageModal.tsx b/nym-wallet/src/components/Buy/SignMessageModal.tsx index eb47a4b7d1..fc958835ff 100644 --- a/nym-wallet/src/components/Buy/SignMessageModal.tsx +++ b/nym-wallet/src/components/Buy/SignMessageModal.tsx @@ -26,13 +26,15 @@ export const SignMessageModal = ({ onClose }: { onClose: () => void }) => { }; if (error) { - { - refresh(); - }} - />; + return ( + { + refresh(); + }} + /> + ); } return ( @@ -69,7 +71,7 @@ export const SignMessageModal = ({ onClose }: { onClose: () => void }) => { Copy signature - + diff --git a/nym-wallet/src/components/Buy/Tutorial.tsx b/nym-wallet/src/components/Buy/Tutorial.tsx index b9df4b4f0c..6ee39088a0 100644 --- a/nym-wallet/src/components/Buy/Tutorial.tsx +++ b/nym-wallet/src/components/Buy/Tutorial.tsx @@ -107,7 +107,7 @@ export const Tutorial = () => { /> -