# (Legacy) XY Finance Widget (iframe)

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.&#x20;

The "Get Started" section below gives a step-by-step walkthrough as to how you're supposed to do to complete the embedding process and personalize your web/app experience, making transactions on your protocol way easier and interfaces look gracefully effortless! The "Configuration" section, however, categorizes the elements (keys) in the code, providing a clearer picture with regard to the website embedded.

## Get Started

Step 1. Paste this code as high in the **\<head>** of the page as possible

```html
<script defer type="text/javascript" src="https://widget.xy.finance/js/bundle.min.js"></script> 
```

Step 2. Paste this **\<div>** tag to the place where you need Widget to display in `body`&#x20;

```html
<div id="xy-finance-widget-root"></div>
```

Step 3. Paste this **\<script>** to the bottom of `body`

```html
<script defer>
  setTimeout(() => {
    // set default config
    const config = {
      fromTokenAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
      sourceChainId: '1',
      toTokenAddress: '0x77777777772cf0455fB38eE0e75f38034dFa50DE',
      targetChainId: '1',
      amount: 1,
      slippage: '1',
      orientation: 'portrait',
      theme: 'dark',
      lockmode: 'none',
      pagecolor: null,
      referrer: '0x856ebdc948afFCc6E24FCe08458051B19de652F6'
    }

    // use widget
    xyFinanceWidget.init(config);
  }, 2000)
</script>
```

### Configuration

<table><thead><tr><th width="196">Key</th><th width="179">Type</th><th width="140">Default</th><th>Note</th></tr></thead><tbody><tr><td>fromTokenAddress</td><td>String</td><td>'0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'</td><td></td></tr><tr><td>sourceChainId</td><td>String</td><td>'1'</td><td></td></tr><tr><td>toTokenAddress</td><td>String</td><td>'0x77777777772cf0455fB38eE0e75f38034dFa50DE'</td><td></td></tr><tr><td>targetChainId</td><td>String</td><td>'1'</td><td></td></tr><tr><td>amount</td><td>Number</td><td>1</td><td></td></tr><tr><td>slippage</td><td>String</td><td>'1'</td><td>If the difference between the estimated quote and execution price exceeds the rate(default rate 1%),the tx will be revoked.</td></tr><tr><td>orientation</td><td><code>portrait</code> | <code>landscape</code></td><td><code>portrait</code></td><td>For now, only support 'portrait'</td></tr><tr><td>theme</td><td><code>dark</code> | <code>light</code></td><td><code>dark</code></td><td></td></tr><tr><td>lockmode</td><td><code>none</code> or <code>both</code> or <code>fromToken</code> or <code>toToken</code></td><td><code>none</code></td><td>Disable user select Token </td></tr><tr><td>pagecolor</td><td>String or null</td><td>null</td><td>Only use HexColor without <code>#</code></td></tr><tr><td>referrer</td><td>String or null</td><td>null</td><td>Address of the referrer, this address will be used uniformly for any future partner incentive programs</td></tr></tbody></table>

The "sourceChainId" and "targetChainId" in the configuration can be found in the page below.

{% content-ref url="/pages/FCnq6AObtaH5cMqaWYl9" %}
[Supported Blockchains/Bridges/DEXs](/supported-blockchains-bridges-dexs.md)
{% endcontent-ref %}

**Theme : Dark**

![](/files/VdfFS3uJ3CuF6k00jNog)

**Theme : Light**

<figure><img src="/files/c5Gp7QpwQ2eTwZrRZNVf" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.xy.finance/bridge-aggregator-integration/xy-finance-widget-iframe/legacy-xy-finance-widget-iframe.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
