Build a transaction: /transactions
Build Transaction
POST
https://api.paraswap.io/transactions/:network
Build parameters for a transaction with the response from /prices
endpoint.
Path Parameters
Name | Type | Description |
---|---|---|
network | number | Network ID. (Mainnet - 1, Optimism - 10, BSC - 56, Polygon - 137, Fantom - 250, zkEVM - 1101, Base - 8453, Arbitrum - 42161, Avalanche - 43114). |
Query Parameters
Name | Type | Description |
---|---|---|
gasPrice | string | Gas-price to be used for the transaction in wei. |
ignoreChecks | boolean | Allows the API to skip performing on-chain checks such as balances, allowances, as well as possible transaction failures.
*Note: The response does not contain |
ignoreGasEstimate | boolean | Allows the API to skip gas checks
*Note: The response does not contain |
onlyParams | boolean | Allows the API to return the contract parameters only.
Default: |
eip1559 | boolean | Allows the API to return EIP-1559 styled transaction with *Note: We currently support EIP1559 transactions in the following chains: Mainnet, Ropsten, and Avalanche. Default: |
Request Body
Name | Type | Description |
---|---|---|
srcToken | string | Destination Token Address. Only Token Symbol could be specified for tokens from |
srcDecimals | integer | Source Token Decimals. (Can be omitted if Token Symbol is provided for |
destToken | string | Destination Token Address. Only Token Symbol could be specified for tokens from |
destDecimals | integer | Destination Token Decimals. (Can be omitted if Token Symbol is provided for |
srcAmount | integer | Source Amount with decimals. Required if side=SELL. Could only be omitted if slippage is provided when side=BUY |
destAmount | integer | Destination amount with decimals. Required if side=BUY. Could only be omitted if slippage is provided when side=SELL. |
priceRoute | object |
|
slippage | integer | Allowed slippage percentage represented in basis points.
Eg: for 2.5% slippage, set the value to 2.5 * 100 = 250; for 10% = 1000. Slippage could be passed instead of |
userAddress | string | Address of the caller of the transaction ( |
txOrigin | string | Whenever |
receiver | string | Address of the Receiver (that will receive the output of the swap). Used for Swap&Transfer. |
partnerAddress | string | Address that will be entitled to claim fees or surplus. *Note: Fees have to be claimed from the Fee Claimer contract unless |
partnerFeeBps | string | If provided it is used together with *Note: Fees have to be claimed from the Fee Claimer contract unless |
partner | string | Your project name. Used for providing analytics on your project swaps. |
permit | string | Hex string for the signature used for Permit. This can be used to avoid giving approval. Helps in saving gas. |
deadline | integer | Timestamp (10 digit/seconds precision) till when the given transaction is valid. For a deadline of 5 minute, deadline: |
isCapSurplus | boolean | Allows for capping the surplus at 1% maximum. Default: |
takeSurplus | boolean | Allows to collect surplus. Works with Default: |
isSurplusToUser | boolean | Specify if user should receive surplus instead of partner.
Default: |
isDirectFeeTransfer | boolean | Specify if fees should be sent directly to the partner instead of registering them on FeeClaimer. Default: |
Most common error messages
The following is a list of the most common error messages of the /transactions
endpoint. Most are self-explanatory and can be self-solved, but feel free to contact ParaSwap Support using the chat in the bottom right corner of this page.
Validation failed: permit signature should be lower than 706
Validation failed: <error>
- params validation failed (message has the exact reason of failure)Missing price route
- price route param is not passedMissing srcAmount
(sell)Cannot specify both slippage and destAmount
(sell)Missing slippage or destAmount
(sell)Missing slippage or srcAmount
(buy)Source Amount Mismatch
(sell)Destination Amount Mismatch
(buy)Missing destAmount
(buy)Cannot specify both slippage and srcAmount
(buy)Network Mismatch
Source Token Mismatch
Destination Token Mismatch
Contract method doesn't support swap and transfer
Side Mismatch
Source Decimals Mismatch
Destination Decimals Mismatch
It is not allowed to pass both params: "positiveSlippageToUser" and "takeSurplus".
- We advise removing "positiveSlippageToUser" because it is deprecatedWhen "isSurplusToUser"="true", "takeSurplus" must be also "true" and either "partnerAddress" or "partner" must be set
When "isDirectFeeTransfer"="true", please also set "takeSurplus"="true" and provide partner/fee information via "partnerFeeBps" & "partnerAddress" or valid "partner" params; or add "referrer" param
Internal Error while building transaction
- something went wrong during the transaction buildUnable to build transaction <code>
- something went wrong during the transaction buildIt is not allowed to have limit-orders Dex or paraswappool Dex in route and 'ignoreChecks=true' together. Consider requesting the price with excluded limit-orders if you want to use 'ignoreChecks': &excludeDEXS=ParaSwapPool,ParaSwapLimitOrders
It seems like the rate has changed, please re-query the latest Price
The rate has changed, please re-query the latest Price
This transaction has some errors and may fail. Please contact support for more details
Not enough <token> balance
Not enough <token> allowance given to TokenTransferProxy(<spender>)
Unable to check price impact
- src or dest tokens don’t have valid usd price
Last updated