import { Wallet } from '@0xsequence/wallet'
import { encodeTypedDataDigest } from '@0xsequence/utils'
// Construct your Sequence Wallet (out of scope for this section)
const wallet: Wallet
// Encode the typed data
const chainId = 1
const typedData = {
types: {
Person: [
{ name: 'name', type: 'string' },
{ name: 'wallet', type: 'address' },
{ name: 'count', type: 'uint8' }
]
},
primaryType: 'Person' as const,
domain: {
name: 'Ether Mail',
version: '1',
chainId: chainId,
verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'
},
message: {
name: 'Bob',
wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
count: 4
}
}
const hashedData = encodeTypedDataDigest(typedData)
const signature = await wallet.signMessage(hashedData)