Account Abstraction
API Reference
User Operation
Generate User Operation Hash
Transfer ERC20 Token

Estimate ERC20 Token Transfer

Overview

This API endpoint allows you to estimate the gas and fees required for transferring ERC20 tokens from an account. It returns a hash that can be used to track the user operation.

  • HTTP Method: POST
  • Endpoint: {{BASE_URL}}/api/v1/userOp/sendToken/hash

Request Body Parameters

  • accountId (required): The unique identifier of the account.
  • tokenAddress (required): The contract address of the ERC20 token to transfer.
  • to (required): The recipient's wallet address.
  • amount (required): The amount of tokens to transfer in the smallest unit (including decimals). For example, if you want to transfer 1 USDC (which has 6 decimals), the amount should be "1000000".

Example Request Body

{
  "accountId": "67959f7927373a6808679de2",
  "tokenAddress": "0x....",
  "to": "0x....",
  "amount": "1000000" // This represents 1 USDC (6 decimals)
}

Request

Request Headers

  • X-APP-ID: (required): APP ID/Project ID obtained from 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-app-id: $YOUR_APP_ID" \
-H "x-signature: $CALCULATED_SIGNATURE" \
-H "x-timestamp: $TIMESTAMP" \
-d '{
    "accountId": "67959f7927373a6808679de2",
    "tokenAddress": "0x....",
    "to": "0x....",
    "amount": "1000000"
}' {{BASE_URL}}/api/v1/userOp/sendToken/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 providing additional information about the operation.
  • data (object): An object containing the operation details.
  • data.hash (string): The hash of the user operation.
  • data.userOpId (string): Unique identifier for the user operation.
  • data.validUntil (number): Timestamp until which the estimation is valid.

Example Response

{
    "status": 200,
    "message": "success",
    "data": {
        "hash": "0xbf16e7e66135aa1622c281cf50216c481fa0b423891815dcb257cc73945413fd",
        "userOpId": "675a5865461f4da1b170557a",
        "validUntil": 1733975917
    }
}