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 totrue
. Learn more about sending gas from one chain to another along with your bridged tokens in the Refuel Guide
Returns the routes available for bridging assets
GET
https://api.socket.tech/v2/quote
Path Parameters
Name | Type | Description |
---|---|---|
fromTokenAddress* | string | Token to be bridged from sending chain |
fromChainId* | string | ID of sending chain |
toTokenAddress* | string | Token to be received on the destination chain |
toChainId* | string | ID of receiving/destination chain |
fromAmount* | string | Amount of sending tokens bridged. This value needs to be decimal adjusted. |
sort* | string | Available filters : "output" -- maximum output by token amount "time" -- sorted by time "gas" -- sorted by transaction fees |
includeBridges | string | ID of Bridges be included in quote ( to be individually added e.g |
excludeBridges | string | ID of Bridges be excluded from quote ( to be individually added e.g |
disableSwapping | boolean | Bool param to disable swapping before bridging |
userAddress* | string | Address of user used to check approvals |
uniqueRoutesPerBridge* | boolean | Returns best route per bridge using sort criteria |
includeDexes | string | ID of Dexes to be included in quote ( to be individually added e.g |
excludeDexes | string | ID of Dexes to be excluded in the quote ( to be individually added e.g |
maxUserTxs | string | Maximum number of transactions required to bridge |
singleTxOnly | boolean | Flag to include routes requiring only one transaction to bridge |
recipient | string | Address of recipient/receiver on destination chain |
isContractCall | boolean | Flag to include only routes/bridges that support transactions where sender is a smart contract |
bridgeWithGas | boolean | Flag for Refuel feature, takes gas from sending chain & sends on destination chain with bridging transaction |
defaultBridgeSlippage | string | Bridge slippage for the route in percentage b/w 0% - 100%. Default Slippage assumed if not passed. |
defaultSwapSlippage | string | Swap slippage for the route in percentage b/w 0% - 100%. Default Slippage assumed if not passed. |
API-KEY needs to be passed in the headers while making the GET
request
Note on request params :
Param | Note |
---|---|
|
|
| Setting |
| For receiving assets on a different address on the destination chain, the |
| Needs to be set for true when |
| 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 |
| 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. |
| 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 |
---|---|
| Unique route ID |
| Returned true if route involves only a DEX swap tx |
| Amount of token being sent on sending chain |
| Amount of token to be received on the destination chain |
| Array of bridge names used by route |
| Minimum balances of native token needed to pay for gas on chains involved in bridging |
| Deprecated, do not use! |
| Total number of user transactions involved in route |
| Address of transaction sender |
| Address of receiver on destination chain |
| Gas fees in USD for route |
| Array of transactions in the bridging route |
| Type of transaction to be performed by user. Values on Types page. |
| Type of transaction. Values on Types page. |
| Chain ID where the transaction is executed |
| Object with meta data of input asset |
| Amount of sending asset involved in step |
| Object with meta data of output asset |
| Expected output from the transaction |
| Number of steps in a transaction in route (For e.g Swap+Bridge is one transaction with 2 steps) |
| ID of DEX-Bridge used in a given transaction |
| Address of sender |
| Transaction data for token approval. It is null for native token transfers. For ERC 20 tokens, allowance needs to be checked |
| 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 |
| Type of step in transaction. Values in Types page |
| 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. |
| Slippage set for swaps. This will be the default slippage, unless specified in quote. |
| Minimum receiving amount estimated considering slippage. |
| Object with meta data of protocol used in step |
| Returns the fee amount deducted by DEX/Bridge and the token in which it's deducted. |
| Object with information of gas paid by user for bridging tx |
| Estimated time in seconds for completion of bridging |
| Estimated maximum time in seconds in which bridging should complete |
| Address of recipient/receiver on destination chain |
| Object metadata of sending token |
| ID of sending chain. e.g Ethereum = 1 |
| Object metadata of receiving token |
| ID of destination chain, e.g Optimism = 10 |
| Unique ID for a given route |
| Object returned when |
| Reasons for bridges not returning a route |
| Code for bridge not returning a route. All codes can be found on the bridgeRouteErrors types page |
| Returned only if |
| Returned only if |
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 :
https://api.socket.tech/v2/swagger/#/Quote/QuoteController_getQuote
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
andrefuel
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
Last updated