LogoLogo
  • Introduction to Unizen
    • Unizen Overview
      • Unizen Liquidity Distribution Mechanism (ULDM)
        • ULDM Performance
      • Unizen Interoperability Protocol (UIP)
        • LayerZero
        • DeBridge
        • Stargate
        • Celer
        • Axelar
        • Thorchain
    • Unizen Dashboard
      • General
      • Portfolio
      • History
    • Unizen Trade
      • Fees
    • Unizen Explore
      • Unizen Omni-Chain Data Pool
    • Unizen Earn
  • ZCX
    • Token Utility
    • Tokenomics
  • API - Introduction
    • Introduction
    • Before you get started
      • Understanding Price Impact and Price Slippage in Token Swaps
      • Token Allowance Management for Non-updatable Allowance Tokens
      • Tokens with taxes
      • Wrapping and Unwrapping Native Tokens
      • Quote expiration deadline
    • Security Best Practices for Integrating Unizen
      • Why disable CORS
      • How to integrate with a reverse proxy
    • Version 2 of our smart contracts
      • Migration to smart contract v2
  • API - GET STARTED
    • QuickStart guide
    • Swagger
    • Information endpoints
      • GET /trade/v1/info/chains
      • GET /trade/v1/info/sources
      • GET/v1/info/cross-providers
      • GET /trade/v1/info/token/search
      • GET /v1/info/token/popular
      • GET /trade/v1/info/token/{chainId}/{tokenAddress}
      • GET /trade/v1/info/tokenLogo/{chainId}/{tokenAddress}
      • GET /info/thorchain-inbound-address
      • GET /trade/v1/info/tx/{txHash}
      • GET /trade/v1/info/trade/{chainId}/{txHash}
      • GET /trade/v1/info/trades
    • Approval
      • GET /trade/v1/{chainId}/approval/spender
      • GET /trade/v1/{chainId}/approval/transaction
      • GET /trade/v1/{chainId}/approval/allowance
    • Single-Chain Swap
      • GET /trade/v1/{chainId}/quote/single
      • GET /trade/v1/{chainId}/swap/single
      • Send transaction in evm chains
      • Send transaction in Solana
    • Cross-Chain Swap
      • GET /trade/v1/{chainId}/quote/cross
      • GET /trade/v1/{chainId}/swap/cross
      • Send transaction
    • Gasless orders
      • POST /trade/v1/gasless/typed-data
      • POST /v1/gasless/estimate
      • POST /v1/gasless/create
      • POST /v1/gasless/cancel
      • GET /trade/v1/gasless/status/{orderId}
      • GET /v1/gasless/orderByAddress/{address}
    • UTXO Assets and Cosmos Swap
      • GET /trade/v1/{chainId}/quote/cross 1
      • GET /trade/v1/{chainId}/swap/cross
      • Sending transactions
    • Efficient Quote Retrieval with Batch Processing
      • GET /trade/v1/{chainId}/batch_quote/single
    • Error Messages
  • GASLESS TRADES
    • Obtaining gasless quotes
    • Gas estimation
    • Executing the trade
    • Following the orders
  • On-Chain Contracts - Get Started
    • Integration with Unizen Contracts for Token Swapping
    • Registering Errors on Smart Contract Calls
  • PERMIT2
    • What is Permit2?
    • Usage in our api
  • WIDGET - Get Started
    • Embed the Unizen Widget
    • Playground
  • Other
    • Smart Contracts
    • Security Audits
    • Roadmap
  • links
    • Unizen
    • Marketing Website
    • Medium
    • Twitter
    • Discord
    • Telegram
Powered by GitBook
On this page

Was this helpful?

  1. On-Chain Contracts - Get Started

Registering Errors on Smart Contract Calls

Since we cannot determine if a gas estimation fails on the integrator's side—particularly when called from the integrator's smart contract—we provide an endpoint to register errors that occur during on-chain calls. This information is highly valuable to us for maintaining service quality, allowing us to analyze and review failed trades (e.g., tokens involved, DEX used, and other relevant details).

Endpoint: POST /api/register-error

This endpoint allows clients to register errors that occur during smart contract calls when conducting a trade. The provided information can include various transaction-related details, though all fields are optional.


Request

  • Method: POST

  • Content-Type: application/json

Request Body Parameters

Field
Type
Description

input_data

string

(Optional) The raw input data of the transaction.

value

string

(Optional) The value of the transaction in wei (smallest unit of the native token).

sender

string

(Optional) The address of the sender initiating the transaction (0x...).

to_address

string

(Optional) The address to which the transaction is sent (0x...).

api_key

string

(Optional) The API key for authentication and tracking.

chain_id

number

(Optional) The ID of the blockchain network where the transaction was conducted.

block_number

number

(Optional) The block number where the transaction was attempted.

transaction_hash

string

(Optional) The hash of the transaction (0x...).


Response

Successful Response

  • HTTP Status: 200 OK

  • Response Body:

    {
      "status": "success",
      "message": "Error registered successfully."
    }

Error Response

  • HTTP Status: 400 Bad Request

  • Response Body (example):

    {
      "status": "error",
      "message": "Invalid request body."
    }

Example Request

Request Body

{
  "input_data": "0xa9059cbb000000000000000000000000d8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
  "value": "1000000000000000000",
  "sender": "0xAbcd1234Ef567890abcd1234Ef567890Abcd1234",
  "to_address": "0xDefg5678Gh901234defg5678Gh901234Defg5678",
  "api_key": "my-secret-api-key",
  "chain_id": 1,
  "block_number": 12345678,
  "transaction_hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
}

Response

jsonCopiar código{
  "status": "success",
  "message": "Error registered successfully."
}

Notes

  1. Optional Fields: All fields in the request are optional; the backend should handle missing fields gracefully.

  2. Error Logging: This endpoint is used to collect transaction details when an error occurs, providing valuable insights for debugging and analytics.

  3. Authentication: If the api-key is required for security, ensure it is validated against your system.

  4. Chain-Specific Handling: The chainId should correspond to the appropriate blockchain network (e.g., Ethereum Mainnet = 1).

This documentation entry provides clear guidelines for developers to use the POST /api/register-error endpoint effectively.

PreviousIntegration with Unizen Contracts for Token SwappingNextWhat is Permit2?

Last updated 5 months ago

Was this helpful?