BlueWallet/hooks/context/useStorage.ts
Marcos Rodriguez Velez bba96e5308 wio
2025-01-12 15:55:26 -04:00

21 lines
616 B
TypeScript

import { useContext } from 'react';
import { StorageContext } from '../../components/Context/StorageProvider';
export const useStorage = () => {
const context = useContext(StorageContext);
const fetchAndSaveWalletTransactions = async (walletID: string) => {
// ...existing implementation to fetch and save transactions...
};
const getTransactions = (walletID: string): Transaction[] => {
const wallet = wallets.find(w => w.getID() === walletID);
return wallet ? wallet.getTransactions() : [];
};
return {
...context,
fetchAndSaveWalletTransactions,
getTransactions,
};
};