Detect opera provider
This commit is contained in:
parent
77f5da5da6
commit
e0ae8c5645
|
@ -23,6 +23,7 @@ export const WALLET_PROVIDER = {
|
||||||
FORTMATIC: 'FORTMATIC',
|
FORTMATIC: 'FORTMATIC',
|
||||||
SQUARELINK: 'SQUARELINK',
|
SQUARELINK: 'SQUARELINK',
|
||||||
WALLETCONNECT: 'WALLETCONNECT',
|
WALLETCONNECT: 'WALLETCONNECT',
|
||||||
|
OPERA: 'OPERA',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ETHEREUM_NETWORK_IDS = {
|
export const ETHEREUM_NETWORK_IDS = {
|
||||||
|
@ -74,6 +75,13 @@ const getProviderName: Function = (web3Provider): string => {
|
||||||
name = WALLET_PROVIDER.TORUS
|
name = WALLET_PROVIDER.TORUS
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
case 'Object':
|
||||||
|
if (navigator && /Opera|OPR\//.test(navigator.userAgent)) {
|
||||||
|
name = WALLET_PROVIDER.OPERA
|
||||||
|
} else {
|
||||||
|
name = 'Wallet'
|
||||||
|
}
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
name = 'Wallet'
|
name = 'Wallet'
|
||||||
}
|
}
|
||||||
|
@ -97,7 +105,7 @@ const getProviderName: Function = (web3Provider): string => {
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
export const INJECTED_PROVIDERS = [WALLET_PROVIDER.SAFE, WALLET_PROVIDER.METAMASK]
|
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()
|
||||||
|
|
Loading…
Reference in New Issue