tbtc.js icon indicating copy to clipboard operation
tbtc.js copied to clipboard

Web3 must set a defaultAccount

Open dmihal opened this issue 5 years ago • 2 comments

When trying to run through a deposit, I ran into an issue where transactions can't be sent because web3.eth.defaultAccount wasn't set.

I don't think its a common practice for devs to set this value, at least I've never used it.

Options to address this would be:

  • Update the documentation, making it clear that this value should be set
  • Query web3.eth.getAccounts() and use account[0]

dmihal avatar May 16 '20 01:05 dmihal

@Shadowfiend what do you think? I'm comfortable with option 2.

liamzebedee avatar May 18 '20 04:05 liamzebedee

I think the move here is to provide the ability to specify an account in config, fall back on defaultAccount, and throw if neither is set rather than implicitly guessing---particularly when there's already a mechanism to spare us the guess in defaultAccount.

Shadowfiend avatar May 21 '20 18:05 Shadowfiend