aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorPaul Bouchon <mail@bitpshr.net>2018-09-15 07:26:03 +0800
committerGitHub <noreply@github.com>2018-09-15 07:26:03 +0800
commit2ec09362c59958a457939724003312024f97393c (patch)
tree465a45e0d04b75fd0455a7bb463a327d2d59cc5c /app/scripts
parentd34edaada169a3e967fa1ba3a3ff00cc6d00c016 (diff)
downloadtangerine-wallet-browser-2ec09362c59958a457939724003312024f97393c.tar
tangerine-wallet-browser-2ec09362c59958a457939724003312024f97393c.tar.gz
tangerine-wallet-browser-2ec09362c59958a457939724003312024f97393c.tar.bz2
tangerine-wallet-browser-2ec09362c59958a457939724003312024f97393c.tar.lz
tangerine-wallet-browser-2ec09362c59958a457939724003312024f97393c.tar.xz
tangerine-wallet-browser-2ec09362c59958a457939724003312024f97393c.tar.zst
tangerine-wallet-browser-2ec09362c59958a457939724003312024f97393c.zip
EIP-1102: Transitionary API (#5256)
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/inpage.js19
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
//