forked from cerc-io/laconic-wallet
26 lines
659 B
TypeScript
26 lines
659 B
TypeScript
import React, { createContext, useState } from 'react';
|
|
|
|
import { AccountsState } from '../types';
|
|
|
|
const AccountsContext = createContext<{
|
|
accounts: AccountsState;
|
|
setAccounts: (account: AccountsState) => void;
|
|
}>({
|
|
accounts: { ethAccounts: [], cosmosAccounts: [] },
|
|
setAccounts: () => {},
|
|
});
|
|
|
|
const AccountsProvider = ({ children }: { children: any }) => {
|
|
const [accounts, setAccounts] = useState<AccountsState>({
|
|
ethAccounts: [],
|
|
cosmosAccounts: [],
|
|
});
|
|
return (
|
|
<AccountsContext.Provider value={{ accounts, setAccounts }}>
|
|
{children}
|
|
</AccountsContext.Provider>
|
|
);
|
|
};
|
|
|
|
export { AccountsContext, AccountsProvider };
|