Search
K

Quote

Returns the routes available for bridging assets

v2/quote

How this endpoint is to be used :
  • This endpoint returns the routes available between sending chain and destination chain for given sending token and receiving token.
  • The routes generated also consider any swaps needed before and after bridging
  • A refuel transaction requires bridgeWithGas param set to true. Learn more about sending gas from one chain to another along with your bridged tokens in the Refuel Guide
get
https://api.socket.tech/v2
/quote
Returns the routes available for bridging assets
API-KEY needs to be passed in the headers while making the GET request

Note on request params :

Param
Note
amount
amount parameter in the query needs to be decimal adjusted. For example 1 USDC = 1000000 as USDC supports upto 6 decimal places. 1 UNI = 1000000000000000000 as UNI supports upto 18 decimal places.
disableSwapping
Setting disableSwapping param to true in /v2/quote also requires the param to be set to true in v2/supported/from-token-list as only tokens which can be bridged without swapping need to be shown to a user.
recipient
For receiving assets on a different address on the destination chain, the recipient param needs to be assigned to the receiving address. If it is not passed in the request, the sender is considered as recipient.
isContractCall
Needs to be set for true when from address in a tx is a smart contract. More in SC integration guide
bridgeWithGas
When true activates Refuel+Bridge functionality, where gas token is taken from the user on the source chain and equivalent gas token is sent on the destination chain. More in Refuel guide
defaultBridgeSlippage
Bridge slippage for route b/w 0% - 100%. This slippage value also needs to be passed in /build-tx or /build-next-tx. Please read more on bridge slippage.
defaultSwapSlippage
Slippage for DEX swaps in a route. This slippage value also needs to be passed in /build-tx or /build-next-tx. The tx fails if receiving amount is less than estimated amount from slippage. The user has to re-try the tx with higher slippage.
NOTE : For Single Bridging Transaction, set singleTxOnly flag totrue.

Description of response parameters

Parameter
Description
routeId
Unique route ID
isOnlySwapRoute
Returned true if route involves only a DEX swap tx
fromAmount
Amount of token being sent on sending chain
toAmount
Amount of token to be received on the destination chain
usedBridgeNames
Array of bridge names used by route
minimumGasBalances
Minimum balances of native token needed to pay for gas on chains involved in bridging
chainGasBalances
Deprecated, do not use!
totalUserTx
Total number of user transactions involved in route
sender
Address of transaction sender
recipient
Address of receiver on destination chain
totalGasFeesInUsd
Gas fees in USD for route
userTxs
Array of transactions in the bridging route
userTxs.userTxType
Type of transaction to be performed by user. Values on Types page.
userTxs.txType
Type of transaction. Values on Types page.
userTxs.chainId
Chain ID where the transaction is executed
userTxs.fromAsset
Object with meta data of input asset
userTxs.fromAmount
Amount of sending asset involved in step
userTxs.toAsset
Object with meta data of output asset
userTxs.toAmount
Expected output from the transaction
userTxs.stepCount
Number of steps in a transaction in route (For e.g Swap+Bridge is one transaction with 2 steps)
userTxs.routePath
ID of DEX-Bridge used in a given transaction
userTxs.sender
Address of sender
userTxs.approvalData
Transaction data for token approval. It is null for native token transfers. For ERC 20 tokens, allowance needs to be checked
userTxs.steps
Array of steps involved in user transaction. This param is not returned when there's only one step in transaction, for e.g directly bridging
userTxs.steps.type
Type of step in transaction. Values in Types page
userTxs.steps.bridgeSlippage
Slippage set for bridge. This will be the default slippage, unless specified in quote. If a bridge does not support slippage, value is 0. Read more on bridge slippage here.
userTxs.steps.swapSlippage
Slippage set for swaps. This will be the default slippage, unless specified in quote.
userTxs.steps.minAmountOut
Minimum receiving amount estimated considering slippage.
userTxs.steps.protocol
Object with meta data of protocol used in step
userTxs.steps.protocolFees
Returns the fee amount deducted by DEX/Bridge and the token in which it's deducted.
userTxs.steps.gasFees
Object with information of gas paid by user for bridging tx
userTxs.serviceTime
Estimated time in seconds for completion of bridging
userTxs.maxServiceTime
Estimated maximum time in seconds in which bridging should complete
userTxs.steps.recipient
Address of recipient/receiver on destination chain
fromAsset
Object metadata of sending token
fromChainId
ID of sending chain. e.g Ethereum = 1
toAsset
Object metadata of receiving token
toChainId
ID of destination chain, e.g Optimism = 10
routePath
Unique ID for a given route
refuel
Object returned when bridgeWithGas set to true and Refuel supports given route
bridgeRouteErrors
Reasons for bridges not returning a route
bridgeRouteErrors.[BRIGE_NAME].status
Code for bridge not returning a route. All codes can be found on the bridgeRouteErrors types page
bridgeRouteErrors.[BRIGE_NAME].minAmount
Returned only if status is MIN_AMOUNT_NOT_MET. This value can be used to let the user know to increase input amount
bridgeRouteErrors.[BRIGE_NAME].maxAmount
Returned only if status is MAX_AMOUNT_EXCEEDED.This value can be used to let the user know to lower input amount
Socket does not charge any fees. The only fees a user needs to pay are gas fees, middleware fees (to DEX for swapping assets if needed) and bridging fees (to bridge provider)
Note : The token address for the native token of a given chain is 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
TEST QUERY :

NEXT STEP

  • The data returned by this endpoint needs to be shown to a user. For reference, check out the Bungee app.
  • Once a user chooses their preferred route, the transaction data for that route needs to be generated through the /v2/build-tx endpoint (Single Tx Bridging)
  • The whole route and refuel object need to be passed in the body for Refuel+Bridge transactions
  • For Multi Tx Bridging, the /v2/route/start endpoint needs to be called