daily pastebin goal
69%
SHARE
TWEET

Untitled

a guest Aug 13th, 2017 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. getProviderName=()=>
  2. {
  3.     let providerName = "UNKNOWN"
  4.  
  5.     if(window.web3.currentProvider.constructor.name === "MetamaskInpageProvider")        
  6.         providerName = "METAMASK"
  7.  
  8.     else if(window.web3.currentProvider.constructor.name === "EthereumProvider")        
  9.         providerName = "MIST"
  10.  
  11.     else if(window.web3.currentProvider.constructor.name === "o")        
  12.         providerName = "PARITY"
  13.  
  14.     else if(window.web3.currentProvider.host.indexOf("infura")!==-1)
  15.         providerName = "INFURA"      
  16.  
  17.     else if(window.web3.currentProvider.host.indexOf("localhost")!==-1)  
  18.         providerName ="LOCALHOST"
  19.  
  20.     return providerName
  21. }
RAW Paste Data
Top