From cde543bcc95e54069563edb4215cc95f6f48cada Mon Sep 17 00:00:00 2001 From: Lyubomir Kiprov Date: Mon, 20 May 2019 13:16:46 +0300 Subject: [PATCH] Unlock account before sending transactions --- .../services/contracts-services/blockchain-service.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/blockchain/services/contracts-services/blockchain-service.js b/src/common/blockchain/services/contracts-services/blockchain-service.js index ff0ddd2..602b21b 100644 --- a/src/common/blockchain/services/contracts-services/blockchain-service.js +++ b/src/common/blockchain/services/contracts-services/blockchain-service.js @@ -4,8 +4,10 @@ import EmbarkJS from '../../../../embarkArtifacts/embarkjs' const getAccount = async () => { try { - const account = (await EmbarkJS.Blockchain.Providers.web3.getAccounts())[0] - return account || (await EmbarkJS.enableEthereum())[0] + const account = (await EmbarkJS.enableEthereum())[0] + return ( + account || (await EmbarkJS.Blockchain.Providers.web3.getAccounts())[0] + ) } catch (error) { throw new Error( 'Could not unlock an account. Consider installing Status on your mobile or Metamask extension',