Skip to content

nionis/bancor-conversion-widget

Repository files navigation

Bancor Conversion Widget

An open sourced widget that uses Bancor's smart contracts to allow a user to convert tokens or ethereum.

Features

  • 🚴 Fast
  • 🔧 Customizable
  • 🙂 Simple usage

Installing and usage:

npm install bancor-conversion-widget --save

in vanilla

<script src="https://unpkg.com/bancor-conversion-widget@latest"></script>

<body onload="render()">
  <script>
    const render = () => {
      // render it
      new BancorConversionWidget({
        target: document.body,
        props: {},
      });
    };
  </script>
</body>

in react

npm install react-svelte --save
import SvelteComponent from "react-svelte";
import BancorConversionWidget from "bancor-conversion-widget";

// render it
<SvelteComponent this={BancorConversionWidget} />;

in svelte

<script>
  import BancorConversionWidget from "bancor-conversion-widget";
</script>

<!-- render it -->
<BancorConversionWidget />

Read a more in-depth integration guide here

Available properties:

Name Description Type Default
tokenSend initial "send" token string "ETH"
tokenReceive initial "receive" token string "BNT"
colors custom colors object src
showRelayTokens show or hide relay tokens boolean false
addresses custom registry addresses object src
affiliate.account affiliate ethereum address string undefined
affiliate.fee affiliate fee percentage (max 3%) number undefined
onChange event triggered on token change function undefined

Live examples: