> ## Documentation Index
> Fetch the complete documentation index at: https://docs.phantom.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sign typed data (EIP-712)

> Sign structured, typed data using the EIP-712 standard on Ethereum and other EVM chains via Phantom.

Sign structured, typed data using the EIP-712 standard. This provides a better user experience by showing human-readable data in the wallet.

**React**

```tsx theme={null}
import { useEthereum } from "@phantom/react-sdk";

function SignTypedData() {
  const { ethereum } = useEthereum();

  const sign = async () => {
    const accounts = await ethereum.getAccounts();

    const typedData = {
      types: {
        EIP712Domain: [
          { name: "name", type: "string" },
          { name: "version", type: "string" },
          { name: "chainId", type: "uint256" },
          { name: "verifyingContract", type: "address" },
        ],
        Order: [
          { name: "from", type: "address" },
          { name: "to", type: "address" },
          { name: "amount", type: "uint256" },
          { name: "nonce", type: "uint256" },
        ],
      },
      primaryType: "Order",
      domain: {
        name: "My App",
        version: "1",
        chainId: 1,
        verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
      },
      message: {
        from: accounts[0],
        to: "0x742D35cC6634C0532925a3b8d4C8Db86fB5C4A7e",
        amount: "1000000000000000000",
        nonce: 1,
      },
    };

    const signature = await ethereum.signTypedData(typedData, accounts[0]);
    console.log("Signature:", signature);
    return signature;
  };

  return <button onClick={sign}>Sign Order</button>;
}
```

**React Native**

> [!WARNING]
>
> **Ethereum methods aren't available on React Native yet.** The React Native SDK connects only through embedded wallets (Google and Apple social login), and EVM support for embedded wallets is coming soon. See [Chain support](/wallet-sdks-overview.md#chain-support) for current availability.

```tsx theme={null}
import { useEthereum } from "@phantom/react-native-sdk";
import { View, Button, Alert, StyleSheet } from "react-native";

function SignTypedData() {
  const { ethereum } = useEthereum();

  const sign = async () => {
    try {
      const accounts = await ethereum.getAccounts();

      const typedData = {
        types: {
          EIP712Domain: [
            { name: "name", type: "string" },
            { name: "version", type: "string" },
            { name: "chainId", type: "uint256" },
            { name: "verifyingContract", type: "address" },
          ],
          Order: [
            { name: "from", type: "address" },
            { name: "to", type: "address" },
            { name: "amount", type: "uint256" },
            { name: "nonce", type: "uint256" },
          ],
        },
        primaryType: "Order",
        domain: {
          name: "My App",
          version: "1",
          chainId: 1,
          verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
        },
        message: {
          from: accounts[0],
          to: "0x742D35cC6634C0532925a3b8d4C8Db86fB5C4A7e",
          amount: "1000000000000000000",
          nonce: 1,
        },
      };

      const signature = await ethereum.signTypedData(typedData, accounts[0]);
      Alert.alert("Success", `Signature: ${signature.slice(0, 20)}...`);
      return signature;
    } catch (error) {
      Alert.alert("Error", error instanceof Error ? error.message : String(error));
      throw error;
    }
  };

  return (
    <View style={styles.container}>
      <Button title="Sign Order" onPress={sign} />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    padding: 20,
  },
});
```

## Verify with viem

```typescript theme={null}
import { verifyTypedData } from "viem";

const isValid = await verifyTypedData({
  address: signerAddress,
  domain: typedData.domain,
  types: typedData.types,
  primaryType: typedData.primaryType,
  message: typedData.message,
  signature,
});
```
