How to use the eth-connect.RequestManager function in eth-connect

To help you get started, we’ve selected a few eth-connect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github decentraland / explorer / kernel / packages / shared / ethereum / provider.ts View on Github external
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 {

eth-connect

Ethereum TypeScript API, middleware to talk to a ethereum node using an async provider

LGPL-3.0
Latest version published 11 months ago

Package Health Score

62 / 100
Full package analysis