Gasless orders

These endpoints facilitate you the creation of gasless orders, to be conducted on our system.

List of endpoints

1. Create Gasless Order

Endpoint: POST /v1/gasless/create

Description: Initiates a new gasless order by submitting the necessary trade details along with the user's signature.

Request Body:

{
  "signature": "string",        // User's digital signature
  "tokenFrom": "string",        // Address of the source token
  "tokenTo": "string",          // Address of the destination token
  "amount": "string",           // Amount to be traded (in smallest units)
  "chainFrom": "integer",       // Source blockchain chain ID
  "chainTo": "integer",         // Destination blockchain chain ID
  "bestDex": "string"           // Preferred decentralized exchange
}

Response:

{
  "success": true,
  "orderId": "string"           // Unique identifier for the created order
}

2. Retrieve Typed Data for Signing

Endpoint: POST /v1/gasless/typed-data

Description: Generates the structured data that the user needs to sign, ensuring the integrity and authorization of the gasless transaction.

Request Body:

{
  "tokenFrom": "string",        // Address of the source token
  "tokenTo": "string",          // Address of the destination token
  "amount": "string",           // Amount to be traded (in smallest units)
  "chainFrom": "integer",       // Source blockchain chain ID
  "chainTo": "integer",         // Destination blockchain chain ID
  "bestDex": "string"           // Preferred decentralized exchange
}

Response:

{
  "success": true,
  "typedData": {
    // Structured data object for user signature
  }
}

3. Cancel Gasless Order

Endpoint: POST /v1/gasless/cancel

Description: Allows the user to cancel a previously created gasless order, provided it hasn't been processed yet.

Request Body:

{
  "orderId": "string"           // Unique identifier of the order to be cancelled
}

Response:

{
  "success": true,
  "message": "Order cancelled successfully"
}

4. Check Gasless Order Status

Endpoint: GET /v1/gasless/status/{orderId}

Description: Retrieves the current status of a specific gasless order, enabling users to monitor its progress.

Path Parameter:

  • orderId: Unique identifier of the order whose status is being queried.

Response:

{
  "success": true,
  "orderId": "string",
  "status": "string",           // Current status (e.g., pending, processing, completed, cancelled, failed)
  "message": "string"           // Additional information about the order status
}

5. Estimate Gas for Gasless Transaction

Endpoint: POST /v1/gasless/estimate

Description: Provides an estimation of the gas costs associated with a proposed gasless transaction, aiding in understanding potential fees.

Request Body:

{
  "tokenFrom": "string",        // Address of the source token
  "tokenTo": "string",          // Address of the destination token
  "amount": "string",           // Amount to be traded (in smallest units)
  "chainFrom": "integer",       // Source blockchain chain ID
  "chainTo": "integer",         // Destination blockchain chain ID
  "bestDex": "string"           // Preferred decentralized exchange
}

Response:

{
  "success": true,
  "gasEstimation": "string",    // Estimated gas units required
  "feeEquivalent": "string"     // Equivalent fee in the specified token (if applicable)
}

These endpoints facilitate the creation, management, and monitoring of gasless orders, streamlining the trading process by covering gas fees on behalf of the user.

For detailed information and additional parameters, please refer to the official API documentation at https://api.zcx.com/trade/docs#/Gasless%20Orders.

Last updated