Request to create a transaction

POST /1.0/client/create-transaction. Accepts the following parameters:

Parametrs Description

networkFrom (string, required)

departure network symbol (for example, Ethereum - ETH, Polygon - POL etc.)

networkTo (string, required)

destination network symbol (similar to networkFrom)

cryptoFrom

departure token symbol (for example, Ethereum - ETH, USDT - USDT etc.)

cryptoTo (string, required)

destination token symbol (similar cryptoFrom)

address (string, required)

the address from which tokens are sent in the departure network, as well as the address to which the tokens arrive in the destination network (at the moment, the address is the same, but we plan to separate these parameters)

amount (string, required)

the number of tokens to be sent from the departure network, accepts the amount in the minimum unit (for example, the decimal of Ethereum is 18, so in order to send 1 ETH, you should enter 1000000000000000000; the decimal of USDT is 6, so in order to send 100 USDT you should enter 100000000).

This call creates a new transaction in the system and returns the transfer data.

An example of a successful response (HTTP Code 200):

{
   "data": {
       "id": "feb1443b-83ab-4dcd-9725-400b84555b7c", //transaction ID in the system
       "service": "lifi", // service that handles the transaction
       "router": "lifi", // router that handles the transaction
       "bridge": "cbridge", // bridge that handles the transaction
       "status": "new", // transaction status in the system
       "transferDataFrom": { // transaction data on the departure network
           "network": "POL", // departure network symbol
           "crypto": "USDC", // departure token symbol
           "decimals": 6, // departure token decimals
           "amount": "26773259", //  transfer amount
           "amountInUsd": "26.77" // transfer amount in USD
       },
       "transferDataTo": { // transaction data on the destination network
           "network": "FTM", // destination network symbol
           "crypto": "USDC", // destination token symbol
           "decimals": 6, // destination token decimals
           "amount": "26741575", // amount to be received
           "amountInUsd": "26.74" // amount to be received в USD
       },
       "transactionData": { // transfer data
           "approve": { // data to confirm token withdrawal (if tokens are sent); if native tokens - this block is empty
               "data": "0x0", // transfer data, which must be signed with a private key
               "addressFrom": "0x4c33c110EA0873c549a6cC1F615bAB9fD7D21263d", // departure address from which the approval is sent
               "addressTo": "0x5c59718F693b2FDbC7c3d8449581dC3a8435AA54", // address to which the approval is sent (the address of the token in the departure network)
               "gasLimit": "0x11170", // the amount of gas the approval burns (in hex format)
               "gasPrice": "0xaa27ae7f5", // gas price in hex format
               "nonce": "0x1a", // serial number of the transaction at the address in hex format
               "coinValue": "0x0", // the number of native tokens sent upon confirmation
               "tokenValue": "0x198870b", // the number of tokens for approval (in hex format)
               "chainId": 137 // departure network ID
           },
           "transfer": { // data for transfer initialization
               "data": "0х0", // transfer data, which must be signed with the private key
               "addressFrom": "0x4c33c110EA0873c58a6cC1F615bAB9fD7D21263d", // address from which the transfer is initialized
               "addressTo": "0x5c59718F693b9FDbC7c3d3149581dC3a8435AA54", // address to which the transfer is initialized (usually a bridge/router contract)
               "gasLimit": "0xf6dfe", // the amount of gas the transfer burns (in hex format)
               "gasPrice": "0xa8d4dc606", // gas price in hex format
               "nonce": "0x1b", // the serial number of the transaction in hex format
               "coinValue": "0x0", // the number of native tokens sent upon transfer initialization
               "tokenValue": "0x198870b", // the number of tokens sent upon transfer initialization
               "chainId": 137 // departure network ID
           }
       },
       "fee": { // bridges and routers fee data
           "amount": "4936.000000", // amount of fee in cryptocurrency
           "symbol": "USDC", // fee currency symbol
           "decimals": 6, // fee currency decimals
           "amountInUsd": "0.00" // amount of fee in USD
       }
   },
   "success": true // request success flag
}

Example of sent data validation error (HTTP code 400):

{
   "success": false, // request success flag
   "message": "Validation error", // error message
   "errors": [ // list of errors
       {
           "field": "networkFrom", // request field, the validation of which ended with an error
           "messages": [ // validation error messages
               "Field are required"
           ]
       }
   ]
}

Example of a common request error (HTTP code 400):

{
   "success": false, // request success flag
   "message": "Not enough balance" // error message
}

Example of server error (HTTP code 500):

{
   "success": false, // request success flag
   "message": "Internal Server Error" // error message
}

Last updated