Goal: Get account details using Stellar Horizon API Javascript SDK
Uses the Stellar Horizon SDK
- Next.js
- Tailwind CSS
- Zustand
Install dependencies
yarn
yarn dev
Go to http://localhost:3000
Create environment variables file
touch .env
pages/index.tsx
- Home page Component
- imports Message.tsx and Button.tsx components
pages/api/auth.ts
- Next.js API file
- Making a
POST
request tohttp://localhost:3000/api/account
using the Stellar SDK to get account details
helpers/store.ts
- This file sets up our zustand store. Zustand is a "small, fast and scalable bearbones state-management solution using simplified flux principles."
components/Button.tsx
- Button component that changes depending on the users actions
- Button onClick functions for each state of the button
components/Message.tsx
- Message component displays the primary text to the user, which changes depending on the users actions