Quickstart
Let's get started with building our dApp! This guide is for developers primarily building on the Bitcoin network or developers looking to integrate liquidity routes to and from any EVM chain to the Bitcoin network.
In this guide, we will be using thirdweb's SDK to connect to a user's wallet via xDefi
and sending a cross-chain transaction using Swing's Cross-Chain API. The process/steps for executing a BTC to ETH transaction, and vice versa, are as follows:
- Getting a quote and selecting the best route
- Sending a transaction
Although not essential for executing a swap transaction, providing your users with real-time updates on the transaction's status by polling the status can significantly enhance the user experience.
Installing xDEFI Wallet
To install xDefi, navigate over to https://www.xdefi.io/
Be sure to use a browser that supports chrome extensions.
Then follow the steps to install xDefi and setup your wallet on their official website.
Cloning The Examples Repository
Before we begin, we'll have to clone the Swing examples repository
Running our dApp
Once you've cloned the examples repo, the next step is to install the necessary packages required for the project to run.
Open the examples repo in VS Code or any code editor of your choice.
The example's repo is a Turbo monorepo containing multiple example projects. The example used in this guide can be found at examples/swaps-api-nextjs-bitcoin
:
Once the packages are installed, we can then run our app:
The references for Swing's Cross-Chain and Platform APIs used in this guide can be found here.