Direct Swap API

Introduction

The Direct Swap API provides seamless integration for cross-chain token swaps. This service supports:

  • Access Key Management: Create, check, and manage API access keys.

  • Quote Generation: Generate swap quotes with customizable parameters.

  • Swap Execution: Perform swaps securely across supported blockchain networks.

  • Transaction Tracking: Monitor swap progress and confirm transaction completion.

Endpoints

/l1x_getNetworkList

GET

Retrieve a list of all supported networks.

/l1x_getXtalkStatus?swapId=<id>

GET

Get the status of a specific swap using its Swap ID.

/access_key/l1x_accessKeyStatus

GET

Check the status of an existing access key.

/access_key/l1x_accessKeyRequest

POST

Request a new access key for API usage.

/l1x_getQuote

POST

Generate a swap quote with input parameters.

/l1x_createSwap

POST

Create and execute a swap using a quote ID.

Detailed Endpoint Descriptions

  1. List Supported Networks

    1. Method: GET

    2. Endpoint: /l1x_getNetworkList

    3. Description: Retrieves a list of all blockchain networks supported by the Direct Swap service.

  • Response Example:

{
  "status": "success",
  "message": "Direct swap network list fetched successfully.",
  "data": [
    {
      "Id": 2,
      "Name": "Ethereum",
      "Symbol": "ETH",
      "DisplaySymbol": "ETH",
      "Token": "ETH",
      "Icon": "null",
      "ChainId": 1,
      "Rpc": "https://delicate-serene-voice.quiknode.pro/25ce84761d4718a40e0001c23c7dfa66ebfc16e8/",
      "IsSwapActive": 1,
      "XtalkNetworkName": "ethereum",
      "DirectSwapTreasuryAddress": "0x2c2E354350095D6f51eac0d4D55d6c037744D431"
    },
    {
      "Id": 3,
      "Name": "Polygon",
      "Symbol": "MATIC",
      "DisplaySymbol": "MATIC",
      "Token": "MATIC",
      "Icon": "null",
      "ChainId": 137,
      "Rpc": "https://flashy-fragrant-diagram.matic.quiknode.pro/d3c0e5fab188019934559fdd7ebc05f93253181e/",
      "IsSwapActive": 1,
      "XtalkNetworkName": "polygon",
      "DirectSwapTreasuryAddress": "0x7AD01f5297D3FD0b05D71C837D93848bff23B5C2"
    },
    {
      "Id": 4,
      "Name": "Binance",
      "Symbol": "BSC",
      "DisplaySymbol": "BSC",
      "Token": "BNB",
      "Icon": "null",
      "ChainId": 56,
      "Rpc": "https://skilled-prettiest-water.bsc.quiknode.pro/bda75739ae1640752fa827b4e4955cb57842efed/",
      "IsSwapActive": 1,
      "XtalkNetworkName": "bsc",
      "DirectSwapTreasuryAddress": "0x4C46e01f22eEAD391ef9Fdbf2d002AdDe2d2d761"
    },
    {
      "Id": 5,
      "Name": "Avalanche",
      "Symbol": "AVAX",
      "DisplaySymbol": "AVAX",
      "Token": "AVAX",
      "Icon": "null",
      "ChainId": 43114,
      "Rpc": "https://blue-smart-layer.avalanche-mainnet.quiknode.pro/261948a9eac541da5075d92111592579ee96e3e3/ext/bc/C/rpc/",
      "IsSwapActive": 1,
      "XtalkNetworkName": "avalanche",
      "DirectSwapTreasuryAddress": "0x337F42Fe0aa52e55A71D30059d790afB86770065"
    },
    {
      "Id": 7,
      "Name": "Optimism",
      "Symbol": "OPTIMISM",
      "DisplaySymbol": "OP",
      "Token": "OP",
      "Icon": "null",
      "ChainId": 10,
      "Rpc": "https://twilight-attentive-morning.optimism.quiknode.pro/446c3b7a34928b914462b9a1fdda567456bc3fc5/",
      "IsSwapActive": 1,
      "XtalkNetworkName": "optimism",
      "DirectSwapTreasuryAddress": "0xa972f26F5Ea73Eb80C5031baCfaF0905087AaF18"
    },
    {
      "Id": 8,
      "Name": "Arbitrum",
      "Symbol": "ARBITRUM",
      "DisplaySymbol": "ARB",
      "Token": "ARB",
      "Icon": "null",
      "ChainId": 42161,
      "Rpc": "https://intensive-ancient-daylight.arbitrum-mainnet.quiknode.pro/b60eaf8acba45cfaf50164345f2beb3b1b09c649/",
      "IsSwapActive": 1,
      "XtalkNetworkName": "arbitrum",
      "DirectSwapTreasuryAddress": "0xa972f26F5Ea73Eb80C5031baCfaF0905087AaF18"
    }
  ]
}

  1. Get Direct X-Talk Status

    • Method: GET

    • Endpoint: /l1x_getXtalkStatus

    • Description: Retrieves the current status of a specific swap.

    • Query Parameters:

      • swapId (required): The unique identifier of the swap.

    • Response Example

{
  "status": "success",
  "message": "Transaction details fetched successfully.",
  "data": {
    "status": "confirmed_on_destination_chain",
    "destination_transaction_hash": "0xcb309eedab7f4dfd562a115bc999c7ba60db96aab41abb31b630b250e74c41f6"
  }
}

  1. Check Access Key Status

    • Method: GET

    • Endpoint: /access_key/l1x_accessKeyStatus

    • Description: Checks whether an access key is active and valid.

    • Response Example

{
  "status": "success",
  "message": "Access key status fetched successfully.",
  "data": {
    "status": "Active",
    "valid_till:": 1746879241
  }
}

  1. Request Access Key

    • Method: POST

    • Endpoint: /access_key/l1x_accessKeyRequest

    • Description: Requests a new access key for API usage.

    • Request Body:

curl --location 'https://dev-api.l1xapp.com/api/v2/direct_swap/access_key/l1x_accessKeyRequest' \
--header 'accept: application/json' \
--header 'accept-language: en-GB,en-US;q=0.9,en;q=0.8' \
--header 'Content-Type: application/json' \
--header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwcm9maWxlSWQiOjgxMCwiaWF0IjoxNzMxNDA4MDUxfQ.B-_wGNsSJldxq8_qLFgQqX7_J0_AqJ1iMVzH2YWuS-8' \
--data '{
    "ips": ["192.168.68.127","0.0.0.0"]
}'
  • Response Body:

{
  "status": "success",
  "data": {
    "accessKey": "7b66e86754a8439de729de67a3876309",
    "validTill": 1746633887
  },
  "message": "Access key generated successfully"
}

  1. Generate Swap Quote

    • Method: POST

    • Endpoint: /l1x_getQuote

    • Description: Generates a quote for a swap based on provided parameters.

    • Request Body Parameters:

      • sourceChainId (required): The ID of the source blockchain.

      • destinationChainId (required): The ID of the destination blockchain.

      • sourceAmount (required): The amount to be swapped.

      • affiliatePercentage (optional): Commission percentage for affiliates (set to 0 if not applicable).

      • affiliateAddress (optional): Wallet address for affiliate commissions.

    • Response Example:

{
  "status": "success",
  "message": "Transaction details fetched successfully.",
  "data": {
    "quoteId": "f56475cd-280f-48c4-985a-6a32bf0326bb",
    "conversionRateId": 1732199177167,
    "sourceChainId": 137,
    "destinationChainId": 56,
    "sourceAssetAddress": "0x0000000000000000000000000000000000000000",
    "destinationAssetAddress": "0x0000000000000000000000000000000000000000",
    "affiliateReceiverAddress": "0x4901E07F1d0712C92cEaEe10F60Ff2C2d41e8c76",
    "sourceAmount": "100000000000000000000",
    "destinationAssetDecimals": 18,
    "destinationAmount": "64775650404042015",
    "destinationAmountBeforeFee": "72770000000000001",
    "fee_details": {
      "sourceAmount": "100000000000000000000",
      "sourceAmountInUSD": "45.636392",
      "srcFixedFeeAmountInUSD": "0.07",
      "destFixedFeeAmountInUSD": "0.1",
      "srclpProviderPercent": "0.035",
      "destlpProviderPercent": "0.05",
      "srclpProviderPercentAmountInUSD": "0.01597273",
      "destlpProviderPercentAmountInUSD": "0.02281819",
      "xTalkNodeCommissionPecent": "5.0",
      "xTalkNodeCommissionAmountInUSD": "0.01148959",
      "totalFeeInUSD": "0.45007231",
      "totalFeeNative": "986213612154089657",
      "destinationGasFeeInUSD": "0.2297918",
      "sourceRoundId": "55340232221130592293",
      "destinationRoundId": "36893488147420489563",
      "estimatedDestinationGas": "366069000000000",
      "affiliateFeePercent": 10,
      "totalFeeAtDestination": "717349595957986",
      "affiliateFeeAtDestination": "7277000000000000"
    },
    "conversionDetails": {
      "MATIC": {
        "BNB": "72770",
        "USDT": "45660000"
      },
      "BNB": {
        "BNB": "100000000",
        "USDT": "62741000000"
      },
      "conversionId": 1732199177167
    }
  }
}

  1. Create Swap

    • Method: POST

    • Endpoint: /l1x_createSwap

    • Description: Creates and executes a swap using the generated quote.

    • Request Body Parameters:

      • quoteId (required): The ID of the generated quote.

      • sender (required): The wallet address of the sender.

      • receiver (required): The wallet address of the receiver.

      • sourceAssetSymbol (required): Token symbol on the source chain.

      • destinationAssetSymbol (required): Token symbol on the destination chain.

    • Response Example:

      {
        "status": "success",
        "message": "Swap created successfully.",
        "data": {
          "swapId": "0x004f245af19239ca8c3f3baa691cde9b85d9ef9281d1012ed9cbf078c908e32d",
          "Id": "05e7d326-6693-447d-9722-5ac0d108e37b",
          "SourceNetworkChainId": 137,
          "DestinationNetworkChainId": 56,
          "SourceAssetAddress": "0x0000000000000000000000000000000000000000",
          "DestinationAssetAddress": "0x0000000000000000000000000000000000000000",
          "SourceAmount": "100000000000000000000",
          "SourceAmountInUSD": "0",
          "DestinationAmountBeforeFee": "68010000000000001",
          "DestinationAmount": "60630044350259896",
          "DestinationAmountInUSD": "37.908935230000004",
          "ConversionRateId": "1731407853661",
          "ConversionSource": "CRYPTOCOMPARE",
          "AffiliateFeePercent": "10",
          "AffiliateFeeAtDestination": "6801000000000001",
          "AffiliateFeeReceiver": "0x4901E07F1d0712C92cEaEe10F60Ff2C2d41e8c76",
          "TotalFeeAtDestination": "578955649740104",
          "AccessKey": "da6349fbabcc01918525b1f6c845d518",
          "senderAddress": "0x639F0759B6054AD8a8acFCcAF904BeE9CbfC71d1",
          "receiverAddress": "0x639F0759B6054AD8a8acFCcAF904BeE9CbfC71d1",
          "sourceAssetSymbol": "MATIC",
          "destinationAssetSymbol": "BSC",
          "internalId": "0d051731408058432",
          "depositReceipientAddress": "0x1DE3bD04135d90A2a6598568F2b1BAFe3936443E",
          "tx": {
            "to": "0x1DE3bD04135d90A2a6598568F2b1BAFe3936443E",
            "value": "100000000000000000000",
            "data": "0x0"
          }
        }
      }
      

  1. Get Affiliate History

    • Method: GET

    • Endpoint: /l1x_getAffiliateHistory

    • Description: Retrieves the affiliate commission history.

{
  "status": "success",
  "message": "Affiliate tx history fetched successfully.",
  "data": {
    "meta": {
      "total": 2,
      "per_page": 1,
      "current_page": 1,
      "last_page": 2,
      "first_page": 1,
      "first_page_url": "/?page=1",
      "last_page_url": "/?page=2",
      "next_page_url": "/?page=2",
      "previous_page_url": null
    },
    "data": [
      {
        "QuoteId": "563038bc-c37c-4631-85ec-1e0e3f9b45f0",
        "AffiliateFeeAtDestination": "25099739000000003",
        "AffiliateFeeReceiver": "0x4901E07F1d0712C92cEaEe10F60Ff2C2d41e8c76",
        "GlobalTxId": "8C517FCCC4F803D7E8C9A1362448EE221CC5A632DEA5B1271CBFE3D6C3F38188",
        "InternalId": "94301731416890045",
        "SwapFulfilledTxHash": "0x7eb151a272c657f6c15ee770896cb4af0e3afc72a30999e6189df5af4dd22b53",
        "DestNetwork": "MATIC"
      }
    ]
  }
}

Last updated