Detect dapper provider

This commit is contained in:
mmv 2019-10-25 16:14:46 +04:00
parent beae72c471
commit e8d54b6228
1 changed files with 11 additions and 2 deletions

View File

@ -24,8 +24,16 @@ export const WALLET_PROVIDER = {
SQUARELINK: 'SQUARELINK', SQUARELINK: 'SQUARELINK',
WALLETCONNECT: 'WALLETCONNECT', WALLETCONNECT: 'WALLETCONNECT',
OPERA: 'OPERA', OPERA: 'OPERA',
DAPPER: 'DAPPER',
} }
export const INJECTED_PROVIDERS = [
WALLET_PROVIDER.SAFE,
WALLET_PROVIDER.METAMASK,
WALLET_PROVIDER.OPERA,
WALLET_PROVIDER.DAPPER,
]
export const ETHEREUM_NETWORK_IDS = { export const ETHEREUM_NETWORK_IDS = {
// $FlowFixMe // $FlowFixMe
1: ETHEREUM_NETWORK.MAINNET, 1: ETHEREUM_NETWORK.MAINNET,
@ -82,6 +90,9 @@ const getProviderName: Function = (web3Provider): string => {
name = 'Wallet' name = 'Wallet'
} }
break break
case 'DapperLegacyProvider':
name = WALLET_PROVIDER.DAPPER
break
default: default:
name = 'Wallet' name = 'Wallet'
} }
@ -105,8 +116,6 @@ const getProviderName: Function = (web3Provider): string => {
return name return name
} }
export const INJECTED_PROVIDERS = [WALLET_PROVIDER.SAFE, WALLET_PROVIDER.METAMASK, WALLET_PROVIDER.OPERA]
export const getAccountFrom: Function = async (web3Provider): Promise<string | null> => { export const getAccountFrom: Function = async (web3Provider): Promise<string | null> => {
const accounts = await web3Provider.eth.getAccounts() const accounts = await web3Provider.eth.getAccounts()