Skip to main content

Overview

Use the Node SDK to sign EIP-712 typed data with your server wallet. Typed data signing is used for permits, order signing, and other structured data that requires a recoverable signature.

Prerequisites

Sign typed data

Call signTypedData on your authenticated DynamicEvmWalletClient with the wallet address and the typed data (viem TypedData format):
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);
The method returns the serialized ECDSA signature as a hex string.

Key shares and password

  • Automatic backup: If you created the wallet with backUpToClientShareService: true, you usually do not need to pass externalServerKeyShares.
  • Manual backup: If you created the wallet with backUpToClientShareService: false, pass your stored key shares as externalServerKeyShares.
  • Password: Pass password only if the wallet was created with a password.
Example with optional parameters:
const signature = await evmClient.signTypedData({
  accountAddress: '0xYourWalletAddress',
  typedData,
  password: 'your-password',           // if wallet is password-protected
  externalServerKeyShares: keyShares,  // if using manual backup
});

Using the Viem wallet client

If you prefer viem’s API, use getWalletClient to get a Viem WalletClient. Its signTypedData method uses the same signing under the hood.

Next steps