save new wallet

This commit is contained in:
PhilReact 2025-03-05 00:25:56 +02:00
parent 77291450c3
commit 7bbe50f881
2 changed files with 25 additions and 1 deletions

View File

@ -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,

View File

@ -577,7 +577,8 @@ const WatchComponent = ({onSeen, isLast, children})=> {
return <div ref={ref} style={{
width: '100%',
display: 'flex',
justifyContent: 'center'
alignItems: 'center',
flexDirection: 'column'
}}>
{children}
</div>