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" />
    </>
  )
}

List of environments we've tested so far:

For more detailed examples, please refer to our example repository where you can find additional information.


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=0x77777777772cf0455fB38eE0e75f38034dFa50DE
import 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

KeyTypeDefaultNote

fromTokenAddress

String

'0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'

sourceChainId

String

'1'

toTokenAddress

String

'0x77777777772cf0455fB38eE0e75f38034dFa50DE'

targetChainId

String

'1'

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

referrer

String or null

null

For the details, please check How do referrer and commissionRate work?

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.

  • commissionRate represents 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.

  • referrer parameter 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