Build Parameters for Transaction

Build Transaction

POST https://apiv5.paraswap.io/transactions/:network

Build parameters for a transaction with the response from /prices endpoint.

Path Parameters

NameTypeDescription

network

number

Network ID. (Mainnet - 1, Ropsten - 3, Polygon - 137, BSC - 56, Avalanche - 43114).

Query Parameters

NameTypeDescription

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 gas parameter when ignoreChecks is set to true. Default: false

ignoreGasEstimate

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

boolean

Allows the API to return the contract parameters only. Default: false

eip1559

boolean

Allows the API to return EIP-1559 styled transaction with maxFeePerGas and maxPriorityFeePerGas paramters.

*Note: We currently support EIP1559 transactions in the following chains:

Mainnet, Ropsten, and Avalanche.

Default: false

Request Body

NameTypeDescription

srcToken

string

Destination Token Address. Only Token Symbol could be specified for tokens from /tokens.

srcDecimals

integer

Source Token Decimals. (Can be omitted if Token Symbol is provided for srcToken).

destToken

string

Destination Token Address. Only Token Symbol could be specified for tokens from /tokens.

destDecimals

integer

Destination Token Decimals. (Can be omitted if Token Symbol is provided for destToken).

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

priceRoute from response body returned from /prices endpoint. priceRoute should be sent exactly as it was returned by the /prices endpoint.

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 destAmount when side=SELL or srcAmount when side=BUY. Min: 0; Max: 10000

userAddress

string

Address of the caller of the transaction (msg.sender)

txOrigin

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

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

partnerFeeBps

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)

*Note: Fees have to be claimed from the Fee Claimer contract

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: Math.floor(Date.now()/1000) + 300 E.g.: 1629214486

positiveSlippageToUser

boolean

(deprecated). Use "takeSurplus" instead. Allows to collect the full positive slippage. Works with partnerAddress

Default: true

takeSurplus

boolean

Allows to collect surplus. Works with partnerAddress

Default: false

{
  "from": "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8",
  "to": "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57",
  "value": "10000000000000000",
  "data": "0xf566103400000000000000000000000075e48c954594d64ef9613aeef97ad85370f13807b2b53dca60cae1d1f93f64d80703b888689f28b63c483459183f2f4271fa0308000000000000000000000000000000000000000000000000002386f26fc100000000000000000000000000000000000000000000000000000000000001c2354900000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7",
  "gasPrice": "47490307239",
  "gas": "197142",
  "chainId": 1
}

Last updated