GET /trade/v1/{chainId}/swap/single

Generate transaction data for single-chain trade via Unizen DEX Aggregator

Generate transaction data for single-chain trade via Unizen DEX Aggregator

post
Authorizations
Path parameters
chainIdnumber · enumRequired

The chain ID of the chain where the swap will be conducted

Example: 56Possible values:
Body
transactionDatastringRequired

The transactionData object obtained from the /quote API, parsed as a string.

Example: {}
nativeValuestringRequired

The native currency value for this transaction, obtained from the /quote API response.

Example: 0
accountstringRequired

The user's address that conducts the trade.

Example: 0xF0Fbf42C54Ac40dA016003baD35E5AefaC6E1CE1
receiverstringOptional

The wallet address that will receive the funds.

Example: 0xF0Fbf42C54Ac40dA016003baD35E5AefaC6E1CE1
tradeTypenumber · enumRequired

tradeType obtained from the /quote API response

Example: 0Possible values:
Responses
200
Generate transaction data for single-chain trade
application/json
post
POST /trade/v1/{chainId}/swap/single HTTP/1.1
Host: 
Authorization: Bearer Bearer
Content-Type: application/json
Accept: */*
Content-Length: 167

{
  "transactionData": "{}",
  "nativeValue": "0",
  "account": "0xF0Fbf42C54Ac40dA016003baD35E5AefaC6E1CE1",
  "receiver": "0xF0Fbf42C54Ac40dA016003baD35E5AefaC6E1CE1",
  "tradeType": 0
}
200

Generate transaction data for single-chain trade

{
  "data": {},
  "contractVersion": "v1",
  "estimateGas": "11231133211313",
  "estimateGasError": "Execution reverted",
  "nativeValue": "0",
  "allowance": "56442235035",
  "insufficientFunds": false,
  "insufficientAllowance": false,
  "insufficientGas": false,
  "maxFeePerGas": "20748300881",
  "maxPriorityFeePerGas": "maxPriorityFeePerGas",
  "gasPrice": "56442235035",
  "estimateGasRawError": "Error: invalid BigNumber string (argument=\"value\", value=\"\", code=INVALID_ARGUMENT, version=bignumber/5.7.0)"
}

Last updated

Was this helpful?