getSafeMessageHash
Returns the Safe message hash of a message ready to be signed.
It returns the same hash returned by the getMessageHash
(opens in a new tab) method in the CompatibilityFallbackHandler
contract.
Usage
_10import { hashSafeMessage } from '@safe-global/protocol-kit'_10import { EIP712TypedData } from '@safe-global/types-kit'_10import { protocolKit } from './setup.ts'_10_10const rawMessage: string | EIP712TypedData = 'Example message'_10const messageHash = hashSafeMessage(rawMessage)_10_10const safeMessageHash = await protocolKit.getSafeMessageHash(messageHash)
Parameters
messageHash
- Type:
string
The hash of the message.
_10const safeMessageHash = await protocolKit.getSafeMessageHash(_10 '0x...'_10)
Returns
Promise<string>
The Safe message hash.