Skip to main content

Iframe Integration

Swap Widget

These docs are deprecated. Please refer to Swap Widget to embed the Pegasys swap widget as a React component in your website in 2 minutes.

Pegasys can be used within other sites as an iframe. An iframe shows an exact version of the Pegasys frontend site and can have custom prefilled settings.

Why You May Want This

Integrating the Pegasys site directly into your web application can be useful for a variety of reasons.

The interface allows users to buy, sell, send, or provide liquidity for ERC20 tokens. An iframe integration may be useful if your application provides services around these ERC20 tokens. (For example, users can buy DAI through a Pegasys iframe on your site, then allow users to lend that DAI on your site).

It can also be useful if your application requires users to acquire some token in order to use some service (For example, allow users to buy "REP" token so they can engage in prediction markets on the Augur Dapp).

iframe vs. custom UI

One benefit of an iframe integration is that the your site will automatically keep up with any improvements/additions to the site. After the initital integration is setup no further work is needed to pull in updates as the exchange site is updated over time.

Example

<iframe
src="https://app.pegasys.fi/#/swap?exactField=input&exactAmount=10&inputCurrency=0x5B0aC6194499621630ddebb30c4aBE37037b30Ec"
height="660px"
width="100%"
style="
border: 0;
margin: 0 auto;
margin-bottom: .5rem;
display: block;
border-radius: 10px;
max-width: 960px;
min-width: 300px;
"
/>

An example of an Iframe integration can be found on the FOAM site https://map.foam.space/

To see the iframe, click the dropdown in the top right and click Get FOAM.

Add To Your Site

To include a Pegasys iframe within your site just add an iframe element within your website code and link to the Pegasys frontent.

Linking to a ETH <-> DAI swap page would look something like this. To link to a token of your choice replace the address after outputCurrency with the token address of the token you want to link to.

<iframe
src="https://app.pegasys.fi/#/swap?outputCurrency=0x48023b16c3e81AA7F6eFFbdEB35Bb83f4f31a8fd"
height="660px"
width="100%"
style="
border: 0;
margin: 0 auto;
display: block;
border-radius: 10px;
max-width: 600px;
min-width: 300px;
"
/>

You can customize the selected page, selected custom tokens and more using URL query parameters. See Custom Linking.