Build a Delta Order to Sign
Build a Delta Order to Sign
POST
https://api.paraswap.io/orders/build
This endpoint gets the Delta price and with ability to fallback to market prices.
Query Parameters
price*
DeltaPrice
chainId*
string
Chain ID. (Mainnet - 1, Optimism - 10, BSC - 56, Polygon - 137, Fantom - 250, zkEVM - 1101, Base - 8453, Arbitrum - 42161, Avalanche - 43114, Gnosis - 100).
owner*
string
Order owner address.
beneficiary
string
Order beneficiary. Default: zero address
, meaning owner address.
slippage
number
Slippage in base points (100
is 1%
). Default: 100
.
deadline
number
Order expiry time as UNIX timestamp. Default: 1 hour from order creation.
nonce
string
Arbitrary uint256
value to be used as order nonce
. Default: value generated with internal algos
. It is recommended to omit this param.
permit
string
partiallyFillable
boolean
If true
, order will be generated as partially fillable. Default: false.
partnerAddress
string
Address of the partner. Used to collect fees from the order. Default: zero address
.
partnerFeeBps
number
Partner fee percent in base points (100
is 1%
). Max value is 200
. Default: 0
.
partnerTakesSurplus
boolean
If true
, partner will collect 50%
of the order surplus instead of flat percent fee. Default: false
.
Most common error types
ValidationError
- validation for params failedUnsupportedChain
- the chain ID is not supported by Delta.UnsupportedToken
- the token is not supported by Delta.InvalidHmac
-hmac
check failed, meaningprice
object returned from/quote
endpoint was mutated.
Supported Permits
Permit(ERC-2612)
- expected to have 224 bytes length.Permit2
TransferFrom
format - expected length is 96 bytes (32 for permitNonce, 64 for compact signature), amount and deadline should be the same as inOrder.
Allowance
format - expected length is 192 bytes.
DAI Style Permit
- expected length is 256 bytes.0x01
- specialpermit
value that signifies existingPermit2
allowance.
Delta Contract should be specified as a spender is a permit.
Sign an Order
Currently only EIP-712
signing is supported for Delta Orders.
Example using ethers
and axios
:
Partner Fees
This is just technical explanation. If you are using our Order Building endpoint, this knowledge is not required.
The fees are enabled by encoding partnerAndFee
param of the order, before its signed by a user.
The param includes three values:
partnerAddress
- on-chain address which will be able to collect the fees.partnerFeeBps
- flat fee percent which will be taken from the order. The value is in base points (100
is1%
), which the maximum allowed value of200
.partnerTakeSurplus
- a flag that, if set, allows the partner to collect50%
of thesurplus
as fees instead of the flat fee specified withpartnerFeeBps
.
These are encoded into a single uint256
value, which then is used as partnerAndFee
.
Last updated