import { authenticatedEvmClient } from './client';
import type { TypedData } from 'viem';
const evmClient = await authenticatedEvmClient();
const typedData = {
domain: {
name: 'My App',
version: '1',
chainId: 8453,
},
types: {
Permit: [
{ name: 'owner', type: 'address' },
{ name: 'spender', type: 'address' },
{ name: 'value', type: 'uint256' },
{ name: 'nonce', type: 'uint256' },
{ name: 'deadline', type: 'uint256' },
],
},
primaryType: 'Permit',
message: {
owner: '0xYourWalletAddress',
spender: '0xContractAddress',
value: 1000000n,
nonce: 0n,
deadline: 1735689600n,
},
} as TypedData;
const signature = await evmClient.signTypedData({
accountAddress: '0xYourWalletAddress',
typedData,
});
console.log('Signature:', signature);