Get Sign Typed Data Hash
Overview
This API endpoint allows you to generate a hash for typed data that can be signed by a smart account. This is useful for verifying the integrity and authenticity of structured data.
- HTTP Method: POST
- Endpoint:
{{BASE_URL}}/api/v1/smart-account/signTypedData/hash
Request Body Parameters
accountId
(required): The unique identifier of the smart account.typedData
(required): The structured data to be hashed, following the EIP-712 standard.
Example Request Body
{
"accountId": "67b1f9310521667c3e94d625",
"typedData": {
"domain": {
"name": "EIP712Domain",
"version": "1",
"chainId": 11155111,
"verifyingContract": "0x5CCB14a189684CbFB2B0f41Ef5594ac7BC80796A"
},
"types": {
"Person": [
{
"name": "name",
"type": "string"
},
{
"name": "wallet",
"type": "address"
}
]
},
"primaryType": "Person",
"message": {
"name": "John Doe",
"wallet": "0x5FbDB2315678afecb367f032d93F642f64180aa3"
}
}
}
Request Headers
X-CLIENT-ID
: (required): Client ID which was generated when registering in Xellar Account Abstraction 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-signature: $CALCULATED_SIGNATURE" \
-H "x-timestamp: $TIMESTAMP" \
-d '{
"accountId": "67b1f9310521667c3e94d625",
"typedData": {
"domain": {
"name": "EIP712Domain",
"version": "1",
"chainId": 11155111,
"verifyingContract": "0x5CCB14a189684CbFB2B0f41Ef5594ac7BC80796A"
},
"types": {
"Person": [
{
"name": "name",
"type": "string"
},
{
"name": "wallet",
"type": "address"
}
]
},
"primaryType": "Person",
"message": {
"name": "John Doe",
"wallet": "0x5FbDB2315678afecb367f032d93F642f64180aa3"
}
}
}' "{{BASE_URL}}/api/v1/smart-account/signTypedData/hash"
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 indicating the result of the operation.data
(object): An object containing the hash of the typed data.
Example Response
{
"status": 200,
"message": "success get hash",
"data": {
"hash": "0x2da87bf63a0fd3a0855b7894369503b5ef73305257b18b96d4d3ecec88ccf13d"
}
}