mirror of
https://github.com/status-im/discover-dapps.git
synced 2025-02-20 14:18:28 +00:00
Unlock account before sending transactions
This commit is contained in:
parent
6b704dc1a8
commit
cde543bcc9
@ -4,8 +4,10 @@ import EmbarkJS from '../../../../embarkArtifacts/embarkjs'
|
|||||||
|
|
||||||
const getAccount = async () => {
|
const getAccount = async () => {
|
||||||
try {
|
try {
|
||||||
const account = (await EmbarkJS.Blockchain.Providers.web3.getAccounts())[0]
|
const account = (await EmbarkJS.enableEthereum())[0]
|
||||||
return account || (await EmbarkJS.enableEthereum())[0]
|
return (
|
||||||
|
account || (await EmbarkJS.Blockchain.Providers.web3.getAccounts())[0]
|
||||||
|
)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Could not unlock an account. Consider installing Status on your mobile or Metamask extension',
|
'Could not unlock an account. Consider installing Status on your mobile or Metamask extension',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user