Build your app
Now that you've deployed and verified your smart contract in part one, the next step is to create a frontend app that enables users to connect their wallet and interact with the smart contract.
In this guide, we will:
- Set up a Next.js app
- Configure our app to connect to Linea Sepolia and your MetaMask wallet
- Add buttons to the app to interact with your smart contract.
Estimated time to complete: ~25 minutes.
Prerequisites
A wallet that can connect to Linea Sepolia. We recommend MetaMask.
Get some Linea Sepolia ETH by heading to our Discord server and asking
in the #developer-chat
channel.
Set up a Next.js app using Dynamic
There are many frameworks out there for building web apps. We're going to focus on Next.js, a React framework.
Conveniently, Dynamic have created the create-dynamic-app
which
quickly creates a web3-enabled Next.js app which already has important packages like Wagmi
and Viem (which Wagmi depends on) installed.
Run it like this:
npx create-dynamic-app@latest
You'll also be prompted in the terminal to to confirm a few project settings. Select Next.js as the framework, then make sure to enable Viem and Wagmi—libraries that we'll be using later.
Once you confirm the configuration, the create-dynamic-app
package will install the necessary
dependencies and your project will be ready to access in the new directory.