Account Abstraction
API Reference
Signing
Build Signature

Build Signature

Overview

This API endpoint allows you to build a signature for either typed data or a message using a smart account. This is useful for creating a valid signature that can be used for authentication or transaction purposes.

  • HTTP Method: POST
  • Endpoint: {{BASE_URL}}/api/v1/smart-account/buildSignature

Request Body Parameters

  • accountId (required): The unique identifier of the smart account.
  • signature (required): The initial signature to be used in the building process.
  • typedData (optional): The structured data to be signed, following the EIP-712 standard. If not provided, the signature will be built for a message.

Example Request Body

With Typed Data

{
  "accountId": "67b1f9310521667c3e94d625",
  "signature": "0xd32432583645f69b7ef2f38dbfe6d9dc9a99fc0949222a8a6c37645bb5ae2eff646e193c6970ecab6b7e63e81fdc6546f146eda932b78d8f41b869524d4238ec00",
  "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"
    }
  }
}

Without Typed Data (For Message)

{
  "accountId": "67b1f9310521667c3e94d625",
  "signature": "0xd32432583645f69b7ef2f38dbfe6d9dc9a99fc0949222a8a6c37645bb5ae2eff646e193c6970ecab6b7e63e81fdc6546f146eda932b78d8f41b869524d4238ec00"
}

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",
    "signature": "0xd32432583645f69b7ef2f38dbfe6d9dc9a99fc0949222a8a6c37645bb5ae2eff646e193c6970ecab6b7e63e81fdc6546f146eda932b78d8f41b869524d4238ec00"
}' "{{BASE_URL}}/api/v1/smart-account/buildSignature"

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 built signature.

Example Response

{
    "status": 200,
    "message": "success build signature",
    "data": {
        "signature": "0xaff553a9ed1fc3ec1806456474b7c480cf7fcbdc4c37eba6aee2704a663568a477feae8d22a259a03677196608eca6d6d4edea5e9b77da7f43ebc115dbd055551b"
    }
}