efx-api-node
Version:
<img src="https://avatars3.githubusercontent.com/u/33315316?s=200&v=4" align="right" />
16 lines (14 loc) • 417 B
JavaScript
/**
* Signs toSign assyncronously
*
* For more information, check:
* https://web3js.readthedocs.io/en/1.0/web3-eth.html#sign
*/
module.exports = (efx, toSign) => {
// metamask will take care of the 3rd parameter, "password"
if (efx.web3.currentProvider.isMetaMask) {
return efx.web3.eth.personal.sign(toSign, efx.get('account'))
} else {
return efx.web3.eth.sign(toSign, efx.get('account'))
}
}