MPC-TSS
Operations
EVM
Signing
Sign Typed Data

Sign Typed Data

API Documentation: Sign Typed Data

Overview

This API endpoint allows you to Sign Typed Data and calculating an Ethereum-specific EIP-712 (opens in a new tab) signature. Equivalent to eth_signTypedData_v4.

  • HTTP Method: POST
  • Endpoint: /api/v1/wallet/eth/sign/typed-data

Request Body Parameters

  • subId (required): this will be used to determine which key used to sign. The type is string.
  • data (required): stringified json sign typed data.

Example Request Body

{  
    "subId": "...",
    "data": "{\"types\":{\"EIP712Domain\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"version\",\"type\":\"string\"},{\"name\":\"chainId\",\"type\":\"uint256\"},{\"name\":\"verifyingContract\",\"type\":\"address\"}],\"Person\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"test\",\"type\":\"uint8\"},{\"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\":\"1\",\"verifyingContract\":\"0xCCCcccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC\"},\"message\":{\"from\":{\"name\":\"Cow\",\"test\":\"3\",\"wallet\":\"0xcD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826\"},\"to\":{\"name\":\"Bob\",\"wallet\":\"0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB\",\"test\":\"2\"},\"contents\":\"Hello, Bob!\"}}"
}

Request

Request Headers

  • X-CLIENT-ID: (required): Client ID which was generated when register in Xellar TSS API Service Dashboard.
  • X-SIGNATURE: (required): Calculated signature, please refer to Authorization section.
  • X-TIMESTAMP: (required): Request timestamp in RFC3339 format.

Example Request Syntax

curl -X POST -H "Content-Type: application/json" -H "x-client-id: $YOUR_CLIENT_ID" -H "x-client-secret: $YOUR_CLIENT_SECRET" -d '{
    "subId": "...",
    "data": "{\"types\":{\"EIP712Domain\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"version\",\"type\":\"string\"},{\"name\":\"chainId\",\"type\":\"uint256\"},{\"name\":\"verifyingContract\",\"type\":\"address\"}],\"Person\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"test\",\"type\":\"uint8\"},{\"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\":\"1\",\"verifyingContract\":\"0xCCCcccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC\"},\"message\":{\"from\":{\"name\":\"Cow\",\"test\":\"3\",\"wallet\":\"0xcD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826\"},\"to\":{\"name\":\"Bob\",\"wallet\":\"0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB\",\"test\":\"2\"},\"contents\":\"Hello, Bob!\"}}"
}' <BASE_URL>/api/v1/wallet/eth/sign/typed-data

Response

The response will include a JSON object with the following properties:

  • status (number): The HTTP status code of the response (e.g., 200 for success).
  • message (string): A message providing additional information about the operation.
  • data (object): An object containing the request information.
  • data.requestId (string): The unique identifier for the request.

Example Response

{
    "status": 200,
    "message": "Sign typed data is in progress",
    "data": {
        "requestId": "9c276eb2-e0e1-4789-bd54-42d5e920379f"        
    }
}