Open sharkfisher opened 7 years ago
@sharkfisher heyo, yes. We have a strict no-sync policy across all methods with ethjs. This is by choice. All methods are to be handled with proper callbacks or promises, so that errors are easier to handle.
See: https://github.com/ethjs/docs#web3js -- for more details.
ethjs-provider-signer/ethjs-provider-http
Issue Type
Description
web3.eth.sendTransaction() supports both a synchronous mode and an async mode. If a callback is not provided, this will be a synchronous call, with a return value being the transaction hash. If a callback is present, it's async. The default Web3.providers.HttpProvider supports both sync and async sends so if the above sendTransaction() is used with the default http provider, both work. ethjs-provider-signer and ethjs-provider-http however only support the async version (sendAsync()). When used as a drop-in replacement for HttpProvider in the sync version, an error is generated:
Can the sync version of send(payload) be added to both ethjs-provider-signer and ethjs-provider-http to make it a full drop-in replacement for HttpProvider, esp. since ethjs-provider-signer is the recommended replacement for HookedWeb3Provider? Efficiency aside, the sync version give people an option when async just can't cut it.
Steps to reproduce
Versions