Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { ethereumConfigurations, ETHEREUM_NETWORK } from 'config'
import { defaultLogger } from 'shared/logger'
import { Account } from 'web3x/account'
import { getUserProfile } from 'shared/comms/peers'
import { getTLD } from '../../config/index'
import { removeUserProfile } from '../comms/peers'
import { Eth } from 'web3x/eth'
declare var window: Window & {
ethereum: any
web3: any
}
export const providerFuture = future()
export const requestManager = new RequestManager(null)
let providerRequested = false
function processLoginAttempt(response: IFuture<{ successful: boolean; provider: any; localIdentity?: Account }>) {
return async () => {
// TODO - look for user id matching account - moliva - 18/02/2020
let userData = getUserProfile()
// Modern dapp browsers...
if (window['ethereum']) {
if (!isSessionExpired(userData)) {
response.resolve({ successful: true, provider: window.ethereum })
} else {
showEthConnectAdvice(false)
let result
try {