Skip to content
This repository has been archived by the owner on Aug 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #291 from gnosis/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
denisgranha committed Jun 14, 2019
2 parents c332518 + 55f34b1 commit 584b7bc
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions dapp/src/services/Web3Service.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
**/
factory.isMetamaskInjected = function () {
return window && (typeof window.web3 !== 'undefined' &&
(window.web3.currentProvider.constructor.name === 'MetamaskInpageProvider' || window.web3.currentProvider.isMetaMask)
(window.web3.currentProvider.constructor.name === 'MetamaskInpageProvider' || window.web3.currentProvider.isMetaMask !== 'undefined')
);
};

Expand All @@ -59,13 +59,16 @@
if ($window.web3 && !$window.ethereum) {
web3 = $window.web3;
}
// TODO: figure out whether Metamask standardizes isEnabled() or find out
// another way to manage it
// https://github.com/MetaMask/metamask-extension/blob/2f7d4494278ad809c1cc9fcc0d9438182003b22d/app/scripts/inpage.js#L101
else if ($window.ethereum && window.ethereum._metamask.isEnabled()) {
else if ($window.ethereum) {
web3 = $window.ethereum;
}

if (!web3) {
reject('Web3 Provider not connected');
return;
}

// Ledger wallet
if (txDefault.wallet == "ledger") {
if (isElectron) {
Expand Down Expand Up @@ -102,12 +105,18 @@
factory.web3 = web3.currentProvider !== undefined ? new MultisigWeb3(web3.currentProvider) : new MultisigWeb3(web3);
// Set accounts
// Convert to checksummed addresses
factory.accounts = factory.toChecksumAddress(factory.web3.eth.accounts);
factory.coinbase = factory.accounts[0];
factory.web3.eth.getAccounts(function (e, accounts) {
if (e) {
throw e;
} else {
factory.accounts = factory.toChecksumAddress(accounts);
factory.coinbase = factory.accounts[0];
}
if (resolve) {
resolve();
}

if (resolve) {
resolve();
}
});
}
else if (txDefault.wallet == 'lightwallet' && isElectron) {
factory.lightWalletSetup();
Expand Down Expand Up @@ -217,8 +226,8 @@
controller: function ($scope, $uibModalInstance, Wallet, options) {
$scope.send = function () {
$uibModalInstance.close(
{
gas: $scope.gasLimit,
{
gas: $scope.gasLimit,
gasPrice: Math.ceil($scope.gasPrice * 1e9)
}
);
Expand Down

0 comments on commit 584b7bc

Please sign in to comment.