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

Detect signature errors produced user rejection. #226

This commit is contained in:
Pedro Gutiérrez 2019-05-15 13:49:31 +02:00 committed by Pedro Gutiérrez
parent 18037db43d
commit d363e3cd2a

View File

@ -10,9 +10,13 @@ export class SignatureUtils extends Instantiable {
}
public async signText(text: string, publicKey: string, password?: string): Promise<string> {
const isMetaMask = this.web3 && this.web3.currentProvider && this.web3.currentProvider.isMetaMask
try {
return await this.web3.eth.personal.sign(text, publicKey, password)
} catch (e) {
if (isMetaMask) {
throw e
}
this.logger.warn("Error on personal sign.")
this.logger.warn(e)
try {