Retrieve Delta price with fallback to Market

Get Delta Price with fallback to Market

GET https://api.paraswap.io/quote

When implementing this endpoint, you can enable API to fallback to market prices if the Delta pricing is not available. If the quote obtained comes from Market pricing data, you’ll get the learn more about the cause in the fallback reason parameter.

This endpoint is also available in Velora SDK. You can find example usage here.

Query Parameters

Name
Type
Description

srcToken*

string

Source Token Address.

srcDecimals*

integer

Source Token Decimals.

destToken*

string

Destination Token Address. For cross-chain quote - destination token on the destination chain. Supported destination tokens for cross-chain can be obtained from /bridge-info endpoint

destDecimals*

integer

Destination Token Decimals.

amount*

string

srcToken amount (in case of SELL) or destToken amount (in case of BUY). The amount should be in WEI/Raw units (eg. 1WBTC -> 100000000)

side

SELL | BUY

Default: SELL.

chainId*

number

Chain ID. (Mainnet - 1, Optimism - 10, BSC - 56, Polygon - 137, Fantom - 250, zkEVM - 1101, Base - 8453, Arbitrum - 42161, Avalanche - 43114, Gnosis - 100).

userAddress

string

User's Wallet Address.

partner

string

Partner string.

mode

ALL | DELTA | MARKET

Preferred mode for the trade. In case of "all", Delta pricing is returned, with Market as a fallback. Default: ALL. MARKET mode is not supported for cross-chain orders

destChainId

number

Destination chain ID for cross-chain quote. (Mainnet - 1, Optimism - 10, BSC - 56, Polygon - 137, Fantom - 250, zkEVM - 1101, Base - 8453, Arbitrum - 42161, Avalanche - 43114, Gnosis - 100).

Query Modes Explained

The endpoint behaves differently based on the mode passed:

  • DELTA - will return the Delta pricing data in the delta field, which can then be used to build, sign and submit a Delta Order.

  • MARKET - will return the Market pricing data in the market field , which is an equivalent to the successful response from /prices?version=6.2 of the Velora API, which can then be used to build a swap transaction. Cross-chain orders are not supported in MARKET mode.

  • ALL - default mode. Will return the Delta pricing data in the delta field. In case the Delta prices are unavailable, fallback to MARKET mode and returns the Market pricing data. Also specifies the fallback reason in fallbackReason field. Refer here for example of usage of this mode.

Response

Fields

Field
Type
Description

delta

object?

Main data structure containing details about the swap and bridge operation. Used to sign and submit a Delta order. See below for details

market

object?

Will return the Market pricing . Included when mode=MARKET, or mode=ALL and delta pricing is not available

deltaAddress

string

Address of the Delta smart contract used to execute the transaction.

delta Object

This section provides information about the swap, bridging path, fees, and available bridge routes.

Core Fields

Field
Type
Description

srcToken

string

ERC20 token address being sent (source token).

destToken

string

Token address being received . For cross-chain orders, this would be the token received on the source chain and sent to bridge

srcAmount

string

Amount of srcToken to be sent

destAmount

string

Final amount received after all fees. For cross-chain orders, this would be the amount received on the source chain and sent to bridge

destAmountBeforeFee

string

Destination token amount before applying fees

gasCostUSD

string

Estimated gas cost of executing the transaction, in USD.

gasCost

string

Estimated gas cost in units of gas.

srcUSD

string

USD equivalent of srcAmount.

destUSD

string

USD equivalent of destAmount after all fees.

partner

string

Partner identifier

partnerFee

number

Partner fee

bridge

Bridge?

Bridge details that should be signed within the order. Available only for cross-chain orders

bridgeInfo

BridgeInfo?

Provides metadata about the selected bridge route.

hmac

string

Hash-based message authentication code

BridgeInfo object

Field
Type
Description

protocolName

string

Name of the bridge protocol (e.g., Across, CCTPStandard, StargateTaxi).

destAmountAfterBridge

string

Amount expected after bridging, in destination token units, on the destination chain

destUSDAfterBridge

string

USD value of destAmountAfterBridge.

estimatedTimeMs

number

Estimated transfer time in milliseconds.

fees

BridgeFee[]

Breakdown of fees charged by the bridge protocol. Some bridges might have no fee

BridgeFee object

Field
Type
Description

feeToken

string

Token address in which the fee is charged (0xeeee... = native token).

amount

string

Fee amount in token’s smallest unit.

amountInUSD

string

Fee value in USD.

AvailableBridge object

Lists all potential bridge routes and their parameters. Each item represents one destination bridge option, containing:

Field
Type
Description

destToken

string

Destination token received on the source chain

destAmount

string

Destination amount received on the source chain

destAmountBeforeFee

string

Destination amount received on the source chain before applying fees

destUSD

string

USD equivalent of destAmount.

gasCostUSD

string

Gas cost estimate in USD for the transaction

bridgeParams

BridgeParams[]

Set of configurations and objects for each protocol variant.

BridgeParams

Field
Type
Description

bridgeInfo

BridgeInfo

Bridge metadata (same structure as above)

bridge

Bridge

Protocol configuration for that bridge (same structure as above)

Examples for Successful Responses for each mode.

{
  "delta": {
    "srcToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
    "destToken": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
    "srcAmount": "100000000",
    "destAmount": "41290907243749599",
    "destAmountBeforeFee": "42763539574055205",
    "gasCostUSD": "3.436417",
    "gasCost": "318930",
    "srcUSD": "99.99940000000001",
    "destUSD": "96.3531578668",
    "destUSDBeforeFee": "99.7895748668493",
    "gasCostBeforeFee": "98300",
    "gasCostUSDBeforeFee": "1.0591657900269833",
    "partner": "paraswap.io-staging",
    "partnerFee": 0,
    "hmac": "7c6b4b9d3a7bfed5c29c924f84abe4bce4add7e9"
  },
  "deltaAddress": "0x0000000000bbf5c5fd284e657f01bd000933c96d"
}

Most common fallback reasons and error types

The following is a list of the most common error messages and fallback reasons of the /delta/quote endpoint. Most are self-explanatory and can be self-solved, but feel free to contact Velora Support using the chat in the bottom right corner of this page.

  • ValidationError - validation for params failed

  • UnsupportedChain - the chain ID is not supported by Delta.

  • UnsupportedToken - the token is not supported by Delta.

  • SourceEth - Native chain token cannot be used as source token in Delta.

  • UnsupportedSide - BUY is not supported by Delta yet.

  • PricingError - internal oracle failed to provide a price.

  • GasCostExceedsTradeAmount - estimated value paid for gas is bigger than trade amount.

Last updated