> For the complete documentation index, see [llms.txt](https://docs.ramper.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ramper.xyz/embedded-wallet-sdk/quickstart/for-web-apps/multichain-supported/sign-typed.md).

# Sign Typed

## Sign Typed Data

{% tabs %}
{% tab title="Code Example" %}
{% code title="sign-typed.tsx" %}

```javascript
import {
  signTypeData,
} from "@ramper-v2/multi";
 
const TYPE_DATA_TEST = JSON.stringify([
  {
    type: "string",
    name: "Message",
    value: "Hi, Alice!",
  },
  {
    type: "uint32",
    name: "A number",
    value: "1337",
  },
])
 
const handleSignTypeData = async () => {
  const result = await signTypeData({
    message: TYPE_DATA_TEST,
    type: 'eth_signTypedData',
    chain,
  });
};
 
```

{% endcode %}
{% endtab %}

{% tab title="Demo UI" %}

<div><figure><img src="https://2309458538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA4lEcolAe1xxpS9iPO2F%2Fuploads%2F19u9XvRwvs36CCoxhFHS%2Fimage.png?alt=media&amp;token=bad40470-933c-44db-acd3-303bea167337" alt=""><figcaption></figcaption></figure> <figure><img src="https://2309458538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA4lEcolAe1xxpS9iPO2F%2Fuploads%2FUtXPfc49L8vyz1YsHwFz%2Fsign-typed-detail.png?alt=media&amp;token=80430456-c5a0-4af1-bdd0-b191785fe472" alt=""><figcaption></figcaption></figure></div>
{% endtab %}
{% endtabs %}

## Sign Typed Data V3

{% tabs %}
{% tab title="Code Example" %}
{% code title="sign-typed-v3.tsx" %}

```javascript
  import {
    signTypeData,
  } from "@ramper-v2/multi";
 
  const TYPE_DATA_TEST =  JSON.stringify({
  types: {
    EIP712Domain: [
      { name: "name", type: "string" },
      { name: "version", type: "string" },
      { name: "chainId", type: "uint256" },
      { name: "verifyingContract", type: "address" },
    ],
    Person: [
      { name: "name", type: "string" },
      { name: "wallet", type: "address" },
    ],
    Mail: [
      { name: "from", type: "Person" },
      { name: "to", type: "Person" },
      { name: "contents", type: "string" },
    ],
  },
  primaryType: "Mail",
  domain: {
    name: "Ether Mail",
    version: "1",
    chainId: 88,
    verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
  },
  message: {
    from: {
      name: "Cow",
      wallet: "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826",
    },
    to: { name: "Bob", wallet: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB" },
    contents: "Hello, Bob!",
  },
})
 
const handleSignTypeDataV3 = async () => {
  const result = await signTypeData({
    message: TYPE_DATA_TEST,
    type: 'eth_signTypedData_v3',
    chain,
  });
};
 
```

{% endcode %}
{% endtab %}

{% tab title="Demo UI" %}

<div><figure><img src="https://2309458538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA4lEcolAe1xxpS9iPO2F%2Fuploads%2Fy6WONqKlXJTkwhxP4txJ%2Fimage.png?alt=media&amp;token=c94214bf-e8d5-42e9-b10c-567a8205feb5" alt=""><figcaption></figcaption></figure> <figure><img src="https://2309458538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA4lEcolAe1xxpS9iPO2F%2Fuploads%2F7Xo2W6DcEzSDC038s9Ty%2Fsign-typed-detailv3.png?alt=media&amp;token=26141eb9-afa6-4cec-b5cb-3b85e7bd952a" alt=""><figcaption></figcaption></figure></div>
{% endtab %}
{% endtabs %}

## Sign Typed Data V4

{% tabs %}
{% tab title="Code Example" %}

```javascript
import {
  signTypeData,
} from "@ramper-v2/multi";
 
const TYPE_DATA_TEST = JSON.stringify({
  domain: {
    chainId: "88",
    name: "Ether Mail",
    verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
    version: "1",
  },
  message: {
    contents: "Hello, Bob!",
    from: {
      name: "Cow",
      wallets: [
        "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826",
        "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF",
      ],
    },
    to: [
      {
        name: "Bob",
        wallets: [
          "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB",
          "0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57",
          "0xB0B0b0b0b0b0B000000000000000000000000000",
        ],
      },
    ],
    attachment: "0x",
  },
  primaryType: "Mail",
  types: {
    EIP712Domain: [
      { name: "name", type: "string" },
      { name: "version", type: "string" },
      { name: "chainId", type: "uint256" },
      { name: "verifyingContract", type: "address" },
    ],
    Group: [
      { name: "name", type: "string" },
      { name: "members", type: "Person[]" },
    ],
    Mail: [
      { name: "from", type: "Person" },
      { name: "to", type: "Person[]" },
      { name: "contents", type: "string" },
      { name: "attachment", type: "bytes" },
    ],
    Person: [
      { name: "name", type: "string" },
      { name: "wallets", type: "address[]" },
    ],
  },
})
 
const handleSignTypeV4 = async () => {
  const result = await signTypeData({
    message: TYPE_DATA_TEST,
    type: 'eth_signTypedData_v4',
    chain,
  });
};
 
```

{% endtab %}

{% tab title="Demo UI" %}

<div><figure><img src="https://2309458538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA4lEcolAe1xxpS9iPO2F%2Fuploads%2FlApCCpCn3sLoy01jbbuK%2Fimage.png?alt=media&amp;token=1fec439b-8fb6-40a5-9290-f1c256b95860" alt=""><figcaption></figcaption></figure> <figure><img src="https://2309458538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA4lEcolAe1xxpS9iPO2F%2Fuploads%2FHQEsD9VFiuRAqPazmt23%2Fsign-typed-detailv4.png?alt=media&amp;token=7c267495-140d-4105-a5f1-5003e6b72a16" alt=""><figcaption></figcaption></figure></div>
{% endtab %}
{% endtabs %}
