Skip to content

Commit

Permalink
Merge pull request #1957 from ethereum/enableInjectedProvider
Browse files Browse the repository at this point in the history
ask permission to injected provider
  • Loading branch information
yann300 authored May 10, 2019
2 parents 5f51f5a + bff7371 commit cf40f4b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'

/* global ethereum */
var $ = require('jquery')
var csjs = require('csjs-inject')
var yo = require('yo-yo')
Expand Down Expand Up @@ -495,8 +495,17 @@ Please make a backup of your contracts and start using http://remix.ethereum.org

executionContext.event.register('contextChanged', this, function (context) {
self.runCompiler()
askPermissionToInjectedProvider(context)
})

let askPermissionToInjectedProvider = (context) => {
if (context === 'injected' && ethereum && typeof ethereum.enable === 'function') {
ethereum.enable()
}
}

askPermissionToInjectedProvider(executionContext.getProvider())

// rerun the compiler when the environement changed
executionContext.event.register('web3EndpointChanged', this, function (context) {
self.runCompiler()
Expand Down

0 comments on commit cf40f4b

Please sign in to comment.