Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.startale.com/llms.txt

Use this file to discover all available pages before exploring further.

Signs typed data per EIP-712. Use for orders, permits, and any signed payload that needs domain separation.

Request

const signature = await provider.request<`0x${string}`>({
  method: 'eth_signTypedData_v4',
  params: [
    address,
    JSON.stringify({
      domain: {
        name: 'My App',
        version: '1',
        chainId: 1868,
        verifyingContract: '0x...',
      },
      types: {
        EIP712Domain: [
          { name: 'name', type: 'string' },
          { name: 'version', type: 'string' },
          { name: 'chainId', type: 'uint256' },
          { name: 'verifyingContract', type: 'address' },
        ],
        Order: [
          { name: 'item', type: 'string' },
          { name: 'amount', type: 'uint256' },
        ],
      },
      primaryType: 'Order',
      message: { item: 'Pass', amount: '1' },
    }),
  ],
})

Parameters

params[0]
`0x${string}`
required
Smart-account address.
params[1]
string | object
required
EIP-712 typed data. Accepts a JSON-stringified string or the object directly; the SDK forwards the value verbatim.

Returns

0x${string}, the signature.

Errors

CodeCause
4001User rejected
4100Wallet not connected
-32602Malformed typed data

Verification

import { publicClient } from './viem'

const isValid = await publicClient.verifyTypedData({
  address,
  domain,
  types,
  primaryType: 'Order',
  message,
  signature,
})