{"size": 991, "ext": "js", "max_stars_repo_path": "web/cashtab/src/utils/context.js", "max_stars_repo_name": "edhoguntur/bitcoin-abc", "max_stars_repo_stars_event_min_datetime": "2021-12-20T18:28:41.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-20T18:28:42.000Z", "max_issues_repo_path": "web/cashtab/src/utils/context.js", "max_issues_repo_name": "tyler-smith/bitcoin-abc", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "web/cashtab/src/utils/context.js", "max_forks_repo_name": "tyler-smith/bitcoin-abc", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.7837837838, "max_line_length": 70, "alphanum_fraction": 0.6972754793}
import React from 'react';
import PropTypes from 'prop-types';
import useWallet from '../hooks/useWallet';
import useWebAuthentication from '../hooks/useWebAuthentication';

export const WalletContext = React.createContext();

export const WalletProvider = ({ children }) => {
    const wallet = useWallet();
    return (
        <WalletContext.Provider value={wallet}>
            {children}
        </WalletContext.Provider>
    );
};

// Authentication Context

export const AuthenticationContext = React.createContext();
export const AuthenticationProvider = ({ children }) => {
    // useWebAuthentication returns null if Web Authn is not supported
    const authentication = useWebAuthentication();
    return (
        <AuthenticationContext.Provider value={authentication}>
            {children}
        </AuthenticationContext.Provider>
    );
};

WalletProvider.propTypes = {
    children: PropTypes.node,
};

AuthenticationProvider.propTypes = {
    children: PropTypes.node,
};
