Web3JS Online
Viem Online
Webhooks, Alerts, and a simple API.
The compactSignatureToHex function is a utility function from the viem library that takes a compact signature, as defined by the EIP-2098 standard, and converts it into a hexadecimal string.
The compact signature is a compressed representation of a signature that consists of two parts: the "r" value, which is a 32-byte hash of the message being signed, and the "yParityAndS" value, which is a 32-byte value that contains the parity information and the "s" value from the signature.
The function takes an object with two properties: "r and yParityAndS," which correspond to the two parts of the compact signature. The "r" property is a hexadecimal string representing the 32-byte hash of the message, and the "yParityAndS" property is also a hexadecimal string representing the 32-byte value containing the parity information and the "s" value.
Here's an example of how you can use the compactSignatureToHex function:
In this example, we first define a compact signature object compactSignature with the r and yParityAndS properties. We then pass this object to the compactSignatureToHex function, which returns a hexadecimal string representing the compact signature. We log this string to the console, which outputs the hexadecimal representation of the compact signature.
Output will appear here. You can scroll the text if it becomes too long.