1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

Merge pull request #90 from oceanprotocol/fix/signing

add detection for meta mask
This commit is contained in:
Sebastian Gerske 2018-12-18 18:05:37 +01:00 committed by GitHub
commit d6af0d8c9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,8 +86,14 @@ export default class ServiceAgreement extends OceanBase {
valueHashes,
timeoutValues)
const serviceAgreementHashSignature = await Web3Provider
.getWeb3().eth.sign(serviceAgreementHash, consumer.getId())
let serviceAgreementHashSignature: string
const web3 = Web3Provider.getWeb3()
if (web3.currentProvider.isMetaMask) {
// password is injected by metamask, dont try to set it!
serviceAgreementHashSignature = await web3.eth.personal.sign(serviceAgreementHash, consumer.getId(), null)
} else {
serviceAgreementHashSignature = await web3.eth.sign(serviceAgreementHash, consumer.getId())
}
return serviceAgreementHashSignature
}