Protocol Kit Reference
Messages
getSafeMessageHash

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


_10
import { hashSafeMessage } from '@safe-global/protocol-kit'
_10
import { EIP712TypedData } from '@safe-global/types-kit'
_10
import { protocolKit } from './setup.ts'
_10
_10
const rawMessage: string | EIP712TypedData = 'Example message'
_10
const messageHash = hashSafeMessage(rawMessage)
_10
_10
const safeMessageHash = await protocolKit.getSafeMessageHash(messageHash)

Parameters

messageHash

  • Type: string

The hash of the message.


_10
const safeMessageHash = await protocolKit.getSafeMessageHash(
_10
'0x...'
_10
)

Returns

Promise<string>

The Safe message hash.

Was this page helpful?