For the complete documentation index, see llms.txt. This page is also available as Markdown.

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
HTTPRequired

[just text field] Please enter token in following format: Bearer

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
datastringRequired

The data associated with the transaction

contractVersionstringRequired

Contract version to execute the trade

Example: v1
estimateGasstringRequired

the estimated amount of gas needed for the transaction

Example: 11231133211313
estimateGasErrorobjectRequired

the estimate gas error, returned from RPC

Example: Execution reverted
nativeValuestringRequired

The value of the transaction in the native currency.

Example: 0
allowancestringRequired

Allowance of the user for the involved token

Example: 56442235035
insufficientFundsbooleanRequired

It is true if the amount to trade exceeds user's funds

Example: false
insufficientAllowancebooleanRequired

It is true if the there is not enough allowance for the token sold

Example: false
insufficientGasbooleanRequired

It is true if there is not enough gas for the transaction

Example: false
maxFeePerGasstringRequired

For EIP1559 usage

Example: 20748300881
maxPriorityFeePerGasstringRequired

For EIP1559 usage

Example: maxPriorityFeePerGas
gasPricestringRequired

Gas Price

Example: 56442235035
estimateGasRawErrorobjectRequired

The raw error returned from RPC or our smart contract

Example: Error: invalid BigNumber string (argument="value", value="", code=INVALID_ARGUMENT, version=bignumber/5.7.0)
post/v1/{chainId}/swap/single
POST /trade/v1/{chainId}/swap/single HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
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