- Easy asess to swaps 3500+ tokens in 6 blockcahins without leaving your product.
- Converting to the required currency for an NFT purchase or any other in-app usage.
- Sell your token.
- Swapping assets in a DeFi application for providing liquidity, farming & staking.
- Extra Revenue by adding your own fees.
1. Configure your widget by URL parametres
https://widget.yad.finance/{chainId}/exchange/
{symbolFrom}/{symbolTo}?
theme={theme}&
feeRecipient={feeRecipient}&
feePercentage={feePercentage}&
isLockNetwork={isLockNetwork}&
isLockFromToken={isLockFromToken}&
isLockToToken={isLockToToken}
Parametrs | Description | Default values | Possible values |
---|---|---|---|
chainId | The blockchain network ID. | 1 (Ethereum) | You can find out it here. |
symbolFrom | Default sell token symbol or token contract address from selected chainId. | Native coin of selected chainID. | You can find out it here or insert your token address. |
symbolTo | Default buy token symbol or token contract address from selected chainId. | DAI | You can find out it here or insert your token address. |
theme | Dark or Ligt mode. | get from browser theme | “dark”, “light” |
feeRecipient | Wallet address for receiving fees. The commission is paid from the purchase token. | null (no fees) | EVM address (in lower or upper cases) |
feePercentage* | Percentage of commission from the amount of purchase tokens, is taken in favor of feeRecipient. | 0 (no fees) | (10 = 1%, maximum value is 500) |
isLockNetwork | If true, user can not change selected network | false | true, false |
isLockFromToken | If true, user can not change selected sell token. | false | true, false |
isLockToToken | If true, user can not change selected buy token. | false | true, false |
- If fees are on, buy amount is shown with fee subtraction.
2. Insert this code, where you want to place widget.
- Vertical widget Width could be in range 280-416 px.
<div id="yad-widget">
<iframe src="https://widget.yad.finance/1/exchange/ETH/DAI"
title="yad-widget" height="508" width="416" style="border-radius:20px">
</iframe>
</div>
In src=
you can put your set up link from pt. 1.
- Horizontal widget
<div id="yad-widget">
<iframe src="https://widget.yad.finance/1/exchange/ETH/DAI"
title="yad-widget" height="212" width="1180" style="border-radius:20px">
</iframe>
</div>
In src=
you can put your set up link from pt. 1.
- Flexible widget
Widget changes automatically depends on width size. If width is lower than 1180, widget is vertical, otherwise horizontal.
<div id="yad-widget">
<iframe src="https://widget.yad.finance/1/exchange/ETH/DAI"
title="yad-widget" height="212" width="1180" style="border-radius:20px">
</iframe>
</div>
For flexible widget you should do two more steps:
- Insert script in
html head
section:
<script type="text/javascript" src="https://widget.yad.finance/widget.min.js"></script>
- Place this script in the bottom of
body
:
<script defer> const yadWidget = new YadWidget(); yadWidget.init();</script>