On this page
evmSignMessage
Ethereum: sign message
Requests a message signature using the key derived from the specified path.
- Follows EIP-191 personal_sign standard
- Not for EIP-712 typed data signing.
- Use evmSignTypedData to sign EIP-712 (v3 and v4)
const result = await HardwareSDK.evmSignMessage(connectId, deviceId, params);Params
path- requiredstring | Array<number>SDK minimum length is3. read moremessageHex- requiredstringMessage to sign, encoded as a hexadecimal string.chainId- optionalnumberThe ChainId in ETH is a unique identifier for a specific Ethereum network, used to distinguish different versions of the blockchain. Reference .
Example
// Original message
const message = "Hello OneKey";
// Convert to hex
const messageHex = Buffer.from(message).toString('hex');
HardwareSDK.evmSignMessage(connectId, deviceId, {
path: "m/44'/60'/0'",
messageHex: messageHex,
chainId: 1
});Result
{
success: true,
payload: {
address: string,
signature: string,
}
}Error
{
success: false,
payload: {
error: string, // error message
code?: string | number // error code
}
}Last updated on