Build Parameters for Transaction

post
Build Transaction

https://apiv5.paraswap.io/transactions/:network
Build parameters for a transaction with the response from /prices endpoint.
Request
Response
Request
Path Parameters
network
required
number
Network ID. (Mainnet - 1, Ropsten - 3, Polygon - 137, BSC - 56, Avalanche - 43114).
Query Parameters
gasPrice
optional
string
Gas-price to be used for the transaction in wei.
ignoreChecks
optional
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 gas parameter when ignoreChecks is set to true. Default: false
ignoreGasEstimate
optional
boolean
Allows the API to skip gas checks *Note: The response does not contain gas parameter when ignoreGasEstimate is set to true. Default: false
onlyParams
optional
boolean
Allows the API to return the contract parameters only. Default: false
Body Parameters
srcToken
required
string
Destination Token Address. Only Token Symbol could be specified for tokens from /tokens.
srcDecimals
optional
integer
Source Token Decimals. (Can be omitted if Token Symbol is provided for srcToken).
destToken
required
string
Destination Token Address. Only Token Symbol could be specified for tokens from /tokens.
destDecimals
optional
integer
Destination Token Decimals. (Can be omitted if Token Symbol is provided for destToken).
srcAmount
optional
integer
Source Amount with decimals. Required if side=SELL. Could only be omitted if slippage is provided when side=BUY
destAmount
optional
integer
Destination amount with decimals. Required if side=BUY. Could only be omitted if slippage is provided when side=SELL.
priceRoute
required
object
priceRoute from response body returned from /prices endpoint. priceRoute should be sent exactly as it was returned by the /prices endpoint.
slippage
optional
integer
Allowed slippage percentage represented in basis points. Eg: for 2.5% slippage, set the value to 0.025 * 10000 = 250; for 10% = 1000. Slippage could be passed instead of destAmount when side=SELL or srcAmount when side=BUY. Min: 0; Max: 10000
userAddress
required
string
Address of the caller of the transaction (msg.sender)
txOrigin
optional
string
Whenever msg.sender (userAddress) i.e. address calling the ParaSwap contract is different than the address sending the transaction, txOrigin must be passed along with userAddress.
receiver
optional
string
Address of the Receiver (that will receive the output of the swap). Used for Swap&Transfer.
partnerAddress
optional
string
Partner Address. If provided, takes precedence over partner parameter.
partnerFeeBps
optional
string
If provided it is used together with partnerAddress. Should be in basis points percentage. Look at slippage parameter description for understanding better. Eg: 200 (for 2% fee percent)
partner
optional
string
Partners who are registered with ParaSwap can pass the partner string instead of passing the partnerAddress and partnerFeeBps.
permit
optional
string
Hex string for the signature used for Permit. This can be used to avoid giving approval. Helps in saving gas.
deadline
optional
integer
Timestamp (10 digit/seconds precision) till when the given transaction is valid. For a deadline of 5 minute, deadline: Math.floor(Date.now()/1000) + 300 E.g.: 1629214486
Response
200: OK
Transaction Request Response (When onlyParams=false)
{
"from": "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8",
"to": "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57",
"value": "10000000000000000",
"data": "0xf566103400000000000000000000000075e48c954594d64ef9613aeef97ad85370f13807b2b53dca60cae1d1f93f64d80703b888689f28b63c483459183f2f4271fa0308000000000000000000000000000000000000000000000000002386f26fc100000000000000000000000000000000000000000000000000000000000001c2354900000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7",
"gasPrice": "47490307239",
"gas": "197142",
"chainId": 1
}
400: Bad Request
Transaction Building Error
{
"error": "Unable to process the transaction"
}