Friday, June 23, 2023

How to Build a Solana dApp: Creating a React TypeScript App with Wallet Adapter


To get started, make sure you have Node.js and npm installed on your computer. Then open your terminal or command prompt and navigate to the directory where you want to create the app.

Once there, run the following command to create a new React app named my-app using the TypeScript template:

Copy Code
npx create-react-app my-app --template typescript

This will create a new React app with TypeScript support.

Next, navigate into the new app's directory by running:

Copy Code
cd my-app

Now, you can install the Solana wallet adapter packages by running the following command:

Copy Code
npm install --save \ @solana/wallet-adapter-base \ @solana/wallet-adapter-react \ @solana/wallet-adapter-react-ui \ @solana/wallet-adapter-wallets \ @solana/web3.js \ react

This will install the necessary packages for the Solana wallet adapter as well as React itself.

You can start the development server by running:

Copy Code
npm start

This will start the app and you can view it in your browser at http://localhost:3000/.

To integrate the Solana wallet adapter into your app, refer to the official Solana documentation for more information on how to set it up and use it.

No comments:

Post a Comment

file tree for nodejs project

 find . \( -path "*/node_modules" -o -path "*/.git" \) -prune -o -print | tree -a -I 'node_modules|.git'