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:
parent
18037db43d
commit
d363e3cd2a
@ -10,9 +10,13 @@ export class SignatureUtils extends Instantiable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async signText(text: string, publicKey: string, password?: string): Promise<string> {
|
public async signText(text: string, publicKey: string, password?: string): Promise<string> {
|
||||||
|
const isMetaMask = this.web3 && this.web3.currentProvider && this.web3.currentProvider.isMetaMask
|
||||||
try {
|
try {
|
||||||
return await this.web3.eth.personal.sign(text, publicKey, password)
|
return await this.web3.eth.personal.sign(text, publicKey, password)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
if (isMetaMask) {
|
||||||
|
throw e
|
||||||
|
}
|
||||||
this.logger.warn("Error on personal sign.")
|
this.logger.warn("Error on personal sign.")
|
||||||
this.logger.warn(e)
|
this.logger.warn(e)
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user