In this example, we're going to show you how to exchange tokens using the Etherspot Exchange. The Etherspot Exchange gives the ability for your users of your dApp or service to take advantage of swapping tokens and using different tokens as needed.
Before we continue...
Whilst the Etherspot Exchange service returns exchange offers on multiple chains, the service does not facilitate swaps from one chain to another. For that, you need to use an official "bridge" service.
We're going to be using one Etherspot SDK instance here:
A mainnet Etherspot SDK to receive our offers. For the purposes of this guide, we're going to assume the variable is called mainnetEtherspotSdk.
When using a different network for the SDK like Polygon or Binance Smart Chain - token swap offers will be returned for their respective chains.