LetsExchange / LetsExchange Blog / How to Use Query Parameters for Your DEX Widget

How to Use Query Parameters for Your DEX Widget

Jun 27, 2023 4 min read

LetsExchange provides top-notch B2B solutions for cryptocurrency exchange. One of these solutions is our exchange widget, which coin teams can utilize to simplify the exchange process of their assets to 4,000+ other coins and tokens. However, coin teams and other cryptocurrency-related businesses can also direct users to the LetsExchange.io website. To enable our partners to make the most of our Swap and DEX features, we have implemented query parameters. This material will explain these parameters specifically for the DEX mode.

Who can benefit from query parameters for the DEX mode?

This option can be especially beneficial for teams of coins listed on DEXes. Implementing query parameters will help them to promote their assets and collaborate with their community. Marketing specialists who promote a specific asset can also find this option useful. Finally, an opportunity to integrate query parameters for DEX may be interesting for all those who want their users to swap a specific coin, a specific amount etc.

With query parameters for the DEX mode, LetsExchange enables its partners to offer users more personalized experiences. By using query parameters correctly, our partners get a marketing tool that allows them to approach users or followers in an indirect way to promote a coin in a mutual cross-promo campaign or to arrange raffles and competitions (e.g. swap not less than a specific amount and get a valuable reward), and similar.

How can you use the query parameters for DEX?

Let’s explore this in more detail.

What Query Parameters Are?

Query parameters are any parameters attached at the end of an URL. They are used to predetermine the content that will be displayed to a user.

You can directly add a query parameter to the URL by separating it with a “?”. If you want to add several parameters, separate them with a “&”.

The LetsExchange DEX mode allows you to set up the following query parameters:

  • mode=DEX – to set up the widget type into DEX mode
  • network=Ethereum (Polygon, or any other network) – to set up the wished network
  • coin_from – for setting up the coin to sell
  • coin_to – it sets up the cryptocurrency to buy
  • sent_amount – it is used to set up the default amount to sell

These parameters work without a connected wallet in the widget, and with a connected one.

Why Are Query Parameters Used?

Query parameters are used to update a query to reflect a specific search term. For example, you want your users to use a DEX for exchanging coins. You add the query parameter ?mode=DEX. So, your link will look like this: https://letsexchange.io/?mode=DEX, and your users will be prompted to swap on a DEX.

Further, you may want your users to sell a specific coin, for example, BIFI. You add a corresponding query parameter to the link. It will look like this: https://letsexchange.io/?mode=DEX&coin_from=BIFI.

Note BIFI is supported by several networks. So, if you want users to swap this coin in a specific network, add a corresponding query parameter. For example, you wish to exchange BIFI in the Optimism network. Then, your affiliate URL will look as follows: https://letsexchange.io/?mode=DEX&network=Optimism&coin_from=BIFI. The coin will be exchanged in the default Ethereum network if you don't do it.

Some coins are supported by one blockchain only. For example, CHAMP is supported by the Polygon blockchain. Considering that the default blockchain for a DEX is Ethereum, you need to provide a query parameter to change it to Polygon. So, your link will look as follows: https://letsexchange.io/?mode=DEX&network=Polygon&coin_from=CHAMP.

Finally, you may want your users to be prompted to swap a specific number of coins. So, add the needed query parameter, for example https://letsexchange.io/?mode=DEX&coin_from=BIFI&sent_amount=900.

And if you want to set up a default coin to receive, use the coin_to query parameter. So, your link will look like this: https://letsexchange.io/?mode=DEX&coin_from=BIFI&sent_amount=900&coin_to=2key. Your users will be prompted to swap 900 BIFI for 2KEY.

Can Query Parameters Be Used for a Swap Functionality?

Yes, absolutely. Query parameters can also be used for the Swap functionality, and the principle of their use is similar to the one for DEX. A detailed description of how to use query parameters for Swap is available here.