superblocks-lab icon indicating copy to clipboard operation
superblocks-lab copied to clipboard

Error when deploying contract when MetaMask is not available

Open filippsen opened this issue 5 years ago • 0 comments

Environment/Browser

Superblocks 2.0

Description

Type error due to undefined object when trying to deploy contract on a browser which doesn't have Metamask installed.

Originally reported by @Spejbl: issue https://github.com/SuperblocksHQ/superblocks-lab/pull/401#pullrequestreview-219190724

Steps to reproduce

  1. Make sure MetaMask is not available or accessible
  2. Click Deploy

Expected result

No errors.

Actual result

image

Hints and possible solutions

Variable row contains this: image

We are probably using some functions from web3 which are not injected without Metamask.

the previous deployer version contained a runtime check-and-swap action that would choose between the internal web3 object and the externally provided one. Now, when the account is set to external (or 'metamask' ?), the new deployer is probably assuming window.web3 is always valid.

./src/services/deployer/deployRunner.ts:37: this.currWeb3 = account.type === 'metamask' ? window.web3 : getWeb3(this.environment.endpoint);

filippsen avatar Mar 31 '19 18:03 filippsen