Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
*/
if (caughtError.message === STD_ERRORS.CANCEL_ACC_EXPORT) {
return warning(messages.userExportCancel);
}
/*
* But throw otherwise, so we can see what's going on
*/
throw new Error(
/*
* @TODO Move message to general
*
* Right now this message string is added under the "static methods" category.
* Since this is used in multiple places, there's a case to be made about
* making it a "general" category message.
*/
`${messages.userExportGenericError}: ${objectToErrorString(
modifiedPayloadObject,
)} ${caughtError.message}`,
);
}
};
return hexSequenceNormalizer(
unsignedTransaction.serialize().toString(HEX_HASH_TYPE),
);
} catch (caughtError) {
/*
* If the user cancels signing the transaction we still throw,
* but we customize the message.
*/
if (caughtError.message === STD_ERRORS.CANCEL_TX_SIGN) {
throw new Error(messages.userSignTxCancel);
}
/*
* But throw otherwise, so we can see what's going on
*/
throw new Error(
`${messages.userSignTxGenericError}: ${objectToErrorString(
modifiedPayloadObject,
)} ${caughtError.message}`,
);
}
};
const { message, signature } = messageVerificationObjectValidator(
signatureMessage,
);
try {
const recoveredAddress: string = verifyEthersMessage(
message,
signature,
);
/*
* Validate the recovered address
*/
addressValidator(recoveredAddress);
return address === recoveredAddress;
} catch (caughtError) {
throw new Error(
`${messages.cannotVerifySignature} ${objectToErrorString(
signatureMessage,
)} Error: ${caughtError.message}`,
);
}
};
* Otherwise EthereumTx will complain because internally it checks for the valid instance
*/
unsignedTransaction.r = hexSequenceNormalizer(rSignatureComponent);
unsignedTransaction.s = hexSequenceNormalizer(sSignatureComponent);
unsignedTransaction.v = hexSequenceNormalizer(recoveryParameter);
const serializedSignedTransaction = unsignedTransaction
.serialize()
.toString(HEX_HASH_TYPE);
/*
* Add the hex prefix
*/
return hexSequenceNormalizer(serializedSignedTransaction);
} catch (caughtError) {
return handleLedgerConnectionError(
caughtError,
`${messages.userSignTxGenericError}: ${objectToErrorString(
transactionObject,
)} ${caughtError.message}`,
);
}
};