evmSignMessage
Ethereum: sign message
Asks device to sign a message using the private key derived by given BIP32 path.
Follows EIP-191 personal_sign standard
Not for EIP-712 typed data signing.
Use evmSignTypedData to signing EIP-712 (v3 and v4)
const result = await HardwareSDK.evmSignMessage(connectId, deviceId, params);
Params
path
— requiredstring | Array<number>
minimum length is3
. read moremessageHex
- requiredstring
message to sign in hex textchainId
- optionalnumber
The 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: number // error code
}
}
Last updated
Was this helpful?