Merge pull request #2292 from ethereum/fix_metamask

Fix Metamask integration
fix-input
yann300 3 years ago committed by GitHub
commit 443a63dfa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      apps/remix-ide/src/blockchain/execution-context.js
  2. 2
      libs/remix-ui/run-tab/src/lib/run-tab.tsx

@ -76,6 +76,15 @@ export class ExecutionContext {
if (this.isVM()) {
callback(null, { id: '-', name: 'VM' })
} else {
if (!web3.currentProvider) {
return callback('No provider set')
}
if (web3.currentProvider.isConnected && !web3.currentProvider.isConnected()) {
if (web3.currentProvider.isMetaMask) {
this.askPermission()
}
return callback('Provider not connected')
}
web3.eth.net.getId((err, id) => {
let name = null
if (err) name = 'Unknown'

@ -56,6 +56,8 @@ export function RunTabUI (props: RunTabProps) {
storage: null,
contract: null
})
runTabInitialState.selectExEnv = props.plugin.blockchain.getProvider()
runTabInitialState.selectExEnv = runTabInitialState.selectExEnv === 'vm' ? 'vm-london' : runTabInitialState.selectExEnv
const [runTab, dispatch] = useReducer(runTabReducer, runTabInitialState)
const REACT_API = { runTab }

Loading…
Cancel
Save