Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lattice signing: use errorMessage prop from LatticeResponseError #1506

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions main/signers/lattice/Lattice/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ interface Signature {
v: Buffer
}

type LatticeResponseError = {
name: 'LatticeResponseError'
responseCode: number
errorMessage: string
}

export const Status = {
OK: 'ok',
CONNECTING: 'connecting',
Expand Down Expand Up @@ -259,7 +265,8 @@ export default class Lattice extends Signer {
return cb(null, signature)
} catch (err) {
log.error('failed to sign message with Lattice', err)
return cb(new Error(err as string))
const latticeErrorMessage = (err as LatticeResponseError).errorMessage
return cb(new Error(latticeErrorMessage))
}
}

Expand All @@ -274,7 +281,8 @@ export default class Lattice extends Signer {
return cb(null, signature)
} catch (err) {
log.error('failed to sign typed data with Lattice', err)
return cb(new Error(err as string))
const latticeErrorMessage = (err as LatticeResponseError).errorMessage
return cb(new Error(latticeErrorMessage))
}
}

Expand All @@ -301,7 +309,8 @@ export default class Lattice extends Signer {
cb(null, addHexPrefix(signedTx.serialize().toString('hex')))
} catch (err) {
log.error('error signing transaction with Lattice', err)
return cb(new Error(err as string))
const latticeErrorMessage = (err as LatticeResponseError).errorMessage
return cb(new Error(latticeErrorMessage))
}
}

Expand Down