SuperblocksHQ/superblocks-lab

Error when deploying contract when MetaMask is not available

Opened this issue · 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 #401 (review)

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);