diff options
author | Paul Bouchon <mail@bitpshr.net> | 2018-09-18 00:11:10 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-18 00:11:10 +0800 |
commit | daca7f9b41d784a44c7f5469b8f9b710e0a08e4b (patch) | |
tree | f00bcf3853428dc785024bc07564d1f02c061c3e /app/scripts | |
parent | 42fdcf6239fc9278cfa85b6ae6cc025cef0e35ae (diff) | |
parent | 2f14f978e390772e78e4cc2ee7a778c9106d053c (diff) | |
download | tangerine-wallet-browser-daca7f9b41d784a44c7f5469b8f9b710e0a08e4b.tar.gz tangerine-wallet-browser-daca7f9b41d784a44c7f5469b8f9b710e0a08e4b.tar.zst tangerine-wallet-browser-daca7f9b41d784a44c7f5469b8f9b710e0a08e4b.zip |
Merge branch 'develop' into eip-712
Diffstat (limited to 'app/scripts')
-rw-r--r-- | app/scripts/inpage.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js index 1a170c617..d9fda1feb 100644 --- a/app/scripts/inpage.js +++ b/app/scripts/inpage.js @@ -22,6 +22,25 @@ var metamaskStream = new LocalMessageDuplexStream({ // compose the inpage provider var inpageProvider = new MetamaskInpageProvider(metamaskStream) +// Augment the provider with its enable method +inpageProvider.enable = function (options = {}) { + return new Promise((resolve, reject) => { + if (options.mockRejection) { + reject('User rejected account access') + } else { + inpageProvider.sendAsync({ method: 'eth_accounts', params: [] }, (error, response) => { + if (error) { + reject(error) + } else { + resolve(response.result) + } + }) + } + }) +} + +window.ethereum = inpageProvider + // // setup web3 // |