How to use the Kryptolite Swap Widget

Kryptolite($KRL) Swap
3 min readJul 27, 2022

--

The first version of the Kryptolite Swap website widget is now available as a library. This widget allows you to easily add support for buying and selling assets to your own websites. It is powered by our Kryptolite Swap smart contract and allows you earn up to 40% from swap fees on your token.

What are some benefits of using the widget?
You surely don’t want users to leave your website and move on to other platforms or swaps to exchange tokens. That is why Kryptolite Swap offers your users the ability to exchange a wide range of tokens right there on your platform? That way, you ensure that they spend time where you need them to and at the same time gain extra points for user-friendliness, users’ retention time and S.E.O ranking.
Moreover you will not have to rely solely on other platforms but will be able to let users exchange other coins/tokens for your token right there on the spot.

How to use the widget
A. Import the following JavaScript files to your website.
1. https://cdn.jsdelivr.net/gh/KRYPTOLITE/kryptolite-swap-widget@main/widget/index.js
2. https://cdn.jsdelivr.net/gh/KRYPTOLITE/kryptolite-swap-widget@main/widget/esm.99a00dd4.js

Or copy and paste this code in the head section of your page

B. Import the CSS library.
1. https://cdn.jsdelivr.net/gh/KRYPTOLITE/kryptolite-swap-widget@main/widget/styles.css

Next, create a div component and with an ID of “kryptolite-swap-widget”, use the data-html element to add your referral wallet address and your base token.

1. data-referraladdress

The address entered in the data-referraladdress attribute is used as a referral to the swap. This address is rewarded for each contract swap performed via the widget.

2. data-basetoken

The address entered in the data-basetoken attribute is the BEP20 contract address for your projects token/coin. This base token is locked in the pair. This means that you can only use the widget to swap between the base token and any other token. This is done to boost your token activity.

We’ll be adding new features soon.

⚠️ You should enter all addresses in checksum format. To avoid errors, copy the address from a blockchain explorer, for example, etherscan.

Some Helpful Technical Tips

  1. Do not conditionally render the element on which the widget will be mounted because the imported script expects to find the root element for mounting the widget after the page loads. As a result, if the document’s html root element is conditionally rendered, you may not see your widget.
  2. If your use case requires you to add the widget conditionally, make sure the script tag is also mounted. Using the widget in a React application is an example. A good solution is to use the react-helmet library or similar technology that can help you control the widgets and script tags.
  3. If you would need technical assistance, tag an admin on our Telegram or Discord or send us an Email with the title “Technical Assistance”

Enjoy the many benefits of buying and holding Kryptolite (KRL). Don’t forget to purchase KRL as well ;)

--

--

Kryptolite($KRL) Swap

KRYPTOLITE is an advanced DeFi aggregation protocol that allows users to retain the stability of their asset positions and get maximum yields with minimal risk.