import React, { createContext, useContext, useState } from 'react'; import { AccountsState } from '../types'; const AccountsContext = createContext<{ accounts: AccountsState; setAccounts: (account: AccountsState) => void; currentIndex: number; setCurrentIndex: (index: number) => void; networkType: string; setNetworkType: (networkType: string) => void; }>({ accounts: { ethAccounts: [], cosmosAccounts: [] }, setAccounts: () => {}, currentIndex: 0, setCurrentIndex: () => {}, networkType: '', setNetworkType: () => {}, }); const useAccounts = () => { const accountsContext = useContext(AccountsContext); return accountsContext; }; const AccountsProvider = ({ children }: { children: any }) => { const [accounts, setAccounts] = useState({ ethAccounts: [], cosmosAccounts: [], }); const [currentIndex, setCurrentIndex] = useState(0); const [networkType, setNetworkType] = useState('eth'); return ( {children} ); }; export { useAccounts, AccountsProvider };