From 36d34a631daab24734d8b2e7f0a6860a802bfd30 Mon Sep 17 00:00:00 2001 From: PhilReact Date: Wed, 5 Mar 2025 00:26:10 +0200 Subject: [PATCH] save new wallet --- src/App.tsx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/App.tsx b/src/App.tsx index 862a6d8..78fd701 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -88,10 +88,12 @@ import { cleanUrl, getFee, getProtocol, + getWallets, groupApi, groupApiLocal, groupApiSocket, groupApiSocketLocal, + storeWallets, } from "./background"; import { executeEvent, @@ -1007,6 +1009,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) { @@ -1043,6 +1065,7 @@ function App() { .then((response) => { if (response && !response.error) { setRawWallet(wallet); + saveWalletToLocalStorage(wallet) setWalletToBeDownloaded({ wallet, qortAddress: wallet.address0,