XY Finance Widget (iframe)
XY Finance Widget is easy to embed into your apps and sites alike, helping engage and retain your users.
XY Finance team has been wracking our brains just to come up with a powerful engagement tool to help strengthen your user retention, making them want to come back more for a satisfying user experience that this widget provides for your website and reducing friction by letting them fast-forward into your app's/site's key functionality. Note that this Widget will be constantly renewed as we're also gathering more resources and collecting feedback from users along the way.
Get Started
Place the <iframe> tag where you want the widget to appear, and you’re all set!
export default function App() {
// You can change the iframe size. Recommended settings: width 480, height 700.
return (
<>
<iframe width={480} height={700} src="https://widget.xy.finance" />
</>
)
}Configuring Default Settings for the Widget
If you’d like to set default values for the widget, simply add search parameters to the URL.
For example:
https://widget.xy.finance/?amount=1&fromTokenAddress=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&lockmode=none&referrer=0x856ebdc948afFCc6E24FCe08458051B19de652F6&commissionRate=2000&slippage=1&sourceChainId=1&targetChainId=1&theme=light&toTokenAddress=0x77777777772cf0455fB38eE0e75f38034dFa50DEimport queryString from 'query-string'
export default function App() {
const config = {
// The address '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' stands for the native token.
fromTokenAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
sourceChainId: '1',
toTokenAddress: '0x77777777772cf0455fB38eE0e75f38034dFa50DE',
targetChainId: '1',
amount: 1,
slippage: '1',
theme: 'dark',
lockmode: 'none',
referrer: '0x856ebdc948afFCc6E24FCe08458051B19de652F6',
commissionRate: 2000
}
const searchParams = queryString.stringify(config)
// amount=1&fromTokenAddress=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&lockmode=none&referrer&slippage=1&sourceChainId=1&targetChainId=1&theme=dark&toTokenAddress=0x77777777772cf0455fB38eE0e75f38034dFa50DE
return (
<div>
<iframe
width={480}
height={700}
src={`https://widget.xy.finance/?${searchParams}`}
/>
</div>
)
}Configuration
fromTokenAddress
String
'0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'
Use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE as the address for a native token in your configuration.
toTokenAddress
String
'0x77777777772cf0455fB38eE0e75f38034dFa50DE'
amount
Number
1
slippage
String
'1'
If the difference between the estimated quote and execution price exceeds the rate (default rate 1%), the tx will be revoked.
theme
dark | light
dark
lockmode
none or both or fromToken or toToken
none
Disable user select Token
commissionRate
Number
0
min: 0
max: 20000
For the details, please check How do referrer and commissionRate work?
How do referrer and commissionRate work?
Setting the commissionRate will collect a fee percentage from the user's swap amount, which is then directly distributed to the specified wallet address. XY Finance will receive a share of these fees, varying according to the use case and transaction volume.
commissionRaterepresents the fee you wish to collect. It is an integer between 0 and 20,000. In this range, 20,000 corresponds to 2%, 1,000 represents 0.1%, and so on in a similar fashion.referrerparameter represents the address where you want to receive the fees. The collected fee in every transaction will be directly transferred to this address. Before proceeding, please ensure that the provided address is under your management and capable of receiving assets correctly.


Last updated
Was this helpful?