From 7bbe50f881e1dc63fb5d398b1ba24b1c00e9eb49 Mon Sep 17 00:00:00 2001 From: PhilReact Date: Wed, 5 Mar 2025 00:25:56 +0200 Subject: [PATCH] save new wallet --- src/App.tsx | 23 +++++++++++++++++++++++ src/components/Chat/MessageItem.tsx | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/App.tsx b/src/App.tsx index 3d7c1e1..b1f0ec8 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -92,10 +92,12 @@ import { cleanUrl, getFee, getProtocol, + getWallets, groupApi, groupApiLocal, groupApiSocket, groupApiSocketLocal, + storeWallets, } from "./background"; import { executeEvent, @@ -1086,6 +1088,26 @@ function App() { } }; + const saveWalletToLocalStorage = async (newWallet)=> { + try { + getWallets().then((res)=> { + + if(res && Array.isArray(res)){ + const wallets = [...res, newWallet] + storeWallets(wallets) + } else { + storeWallets([newWallet]) + } + setIsLoading(false) + }).catch((error)=> { + console.error(error) + setIsLoading(false) + }) + } catch (error) { + console.error(error) + } + } + const createAccountFunc = async () => { try { if (!walletToBeDownloadedPassword) { @@ -1125,6 +1147,7 @@ function App() { }, (response) => { if (response && !response?.error) { + saveWalletToLocalStorage(wallet) setRawWallet(wallet); setWalletToBeDownloaded({ wallet, diff --git a/src/components/Chat/MessageItem.tsx b/src/components/Chat/MessageItem.tsx index 1fd7203..1f4a21d 100644 --- a/src/components/Chat/MessageItem.tsx +++ b/src/components/Chat/MessageItem.tsx @@ -577,7 +577,8 @@ const WatchComponent = ({onSeen, isLast, children})=> { return
{children}